function shortcut_set_switch_access
Same name in other branches
- 9 core/modules/shortcut/shortcut.module \shortcut_set_switch_access()
- 8.9.x core/modules/shortcut/shortcut.module \shortcut_set_switch_access()
- 10 core/modules/shortcut/shortcut.module \shortcut_set_switch_access()
- 11.x core/modules/shortcut/shortcut.module \shortcut_set_switch_access()
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.
1 call to shortcut_set_switch_access()
- shortcut_preprocess_page in modules/
shortcut/ shortcut.module - Implements hook_preprocess_page().
1 string reference to 'shortcut_set_switch_access'
- shortcut_menu in modules/
shortcut/ shortcut.module - Implements hook_menu().
File
-
modules/
shortcut/ shortcut.module, line 268
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.