function subuser_access_delete_callback in Subuser 8
Same name and namespace in other branches
- 7.2 subuser.module \subuser_access_delete_callback()
Our access callback for user deleting - only permits users with 'delete subusers' to delete user or parent-user to delete subusers
Parameters
$account: the account being deleted (user object or uid)
2 calls to subuser_access_delete_callback()
- subuser_profile2_access in ./
subuser.module - Implements hook_profile2_access().
- subuser_ui_list_page in subuser_ui/
subuser_ui.module
1 string reference to 'subuser_access_delete_callback'
- subuser_menu_alter in ./
subuser.module - Implements hook_menu_alter().
File
- ./
subuser.module, line 109 - Provides primary Drupal hook implementations.
Code
function subuser_access_delete_callback($account) {
global $user;
$children = subuser_load_all($user);
$acct_uid = is_object($account) ? $account->uid : $account;
return ($user->uid == $acct_uid && user_access('cancel account') || user_access('delete subusers') && in_array($acct_uid, $children) || user_access('administer users')) && $acct_uid > 0;
}