You are here

is_masquerading.inc in Masquerade Extras 6

Same filename and directory in other branches
  1. 7 masquerade_ctools/plugins/access/is_masquerading.inc

File

masquerade_ctools/plugins/access/is_masquerading.inc
View source
<?php

/**
 * @file
 *  Ctools access plugin which checks whether or not a user is currently masquerading.
 */
$plugin = array(
  'title' => t('User: Is Masquerading'),
  'description' => t('Checks whether or not a user is masquerading as another.'),
  'callback' => 'masquerade_ctools_is_masquerading_access_check',
  'default' => array(),
  'summary' => 'masquerade_ctools_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_ctools_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_ctools_is_masquerading_access_summary($conf, $context) {
  return t('Current User: is masquerading as someone else.');
}

Functions

Namesort descending Description
masquerade_ctools_is_masquerading_access_check Checks if the user is currently masquerading as another. If no context is provided, this will automatically return FALSE.
masquerade_ctools_is_masquerading_access_summary Provides a simple access summary to administrators for this plugin.