On this page
function shortcut_set_switch_access
shortcut_set_switch_access($account = NULL)Access callback for switching the shortcut set assigned to a user account.
Parameters
object $account: (optional) The user account whose shortcuts will be switched. If not set, permissions will be checked for switching the logged-in user's own shortcut set.
Return value
TRUE if the current user has access to switch the shortcut set of the provided account, FALSE otherwise.
File
- modules/shortcut/shortcut.module, line 268
- Allows users to manage customizable lists of shortcut links.
Code
function shortcut_set_switch_access($account = NULL) {
  global $user;
  if (user_access('administer shortcuts')) {
    // Administrators can switch anyone's shortcut set.
    return TRUE;
  }
  if (!user_access('switch shortcut sets')) {
    // The user has no permission to switch anyone's shortcut set.
    return FALSE;
  }
  if (!isset($account) || $user->uid == $account->uid) {
    // Users with the 'switch shortcut sets' permission can switch their own
    // shortcuts sets.
    return TRUE;
  }
  return FALSE;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
 https://api.drupal.org/api/drupal/modules!shortcut!shortcut.module/function/shortcut_set_switch_access/7.x