Access callback for switching the shortcut set assigned to a user account.
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.
TRUE if the current user has access to switch the shortcut set of the provided account, FALSE otherwise.
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;
}