diff --git a/masquerade_ctools/masquerade_ctools.info b/masquerade_ctools/masquerade_ctools.info new file mode 100644 index 0000000..a4a0d44 --- /dev/null +++ b/masquerade_ctools/masquerade_ctools.info @@ -0,0 +1,4 @@ +name = Chaos Tools support for Masquerade +core = 7.x +dependencies[] = ctools +dependencies[] = masquerade diff --git a/masquerade_ctools/masquerade_ctools.module b/masquerade_ctools/masquerade_ctools.module new file mode 100644 index 0000000..a9495ab --- /dev/null +++ b/masquerade_ctools/masquerade_ctools.module @@ -0,0 +1,19 @@ + t('User: Is Masquerading'), + 'description' => t('Checks whether or not a user is masquerading as another.'), + 'callback' => 'masquerade_is_masquerading_access_check', + 'default' => array(), + 'summary' => 'masquerade_is_masquerading_access_summary', + 'required context' => array(), +); + +/** + * Checks if the user is currently masquerading as another. + * If no context is provided, this will automatically return FALSE. + * @return + * TRUE if the current user is masquerading, FALSE otherwise. + */ +function masquerade_is_masquerading_access_check($conf, $context) { + if (isset($_SESSION['masquerading']) && is_numeric($_SESSION['masquerading'])) { + return TRUE; + } + else { + return FALSE; + } +} + +/** + * Provides a simple access summary to administrators for this plugin. + * @return + * A string which states whether or not the current user is masquerading. + */ +function masquerade_is_masquerading_access_summary($conf, $context) { + return t('Current User: is masquerading as someone else.'); +}