You are here

function subuser_access_edit_callback in Subuser 8

Same name and namespace in other branches
  1. 7.2 subuser.module \subuser_access_edit_callback()

Our access callback for user editing - only permits users with 'edit subusers' to edit user or parent-user to edit subusers

Parameters

$account: the account being edited (user object or uid)

2 calls to subuser_access_edit_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_edit_callback'
subuser_menu_alter in ./subuser.module
Implements hook_menu_alter().

File

./subuser.module, line 92
Provides primary Drupal hook implementations.

Code

function subuser_access_edit_callback($account) {
  global $user;
  $children = subuser_load_all($user);
  $acct_uid = is_object($account) ? $account->uid : $account;
  return ($user->uid == $acct_uid || user_access('administer users') || user_access('edit subusers') && in_array($acct_uid, $children)) && $acct_uid > 0;
}