You are here

function subuser_user_edit_access in Subuser 6

Modified version of user_edit_access() for 'administer subusers' logic.

1 call to subuser_user_edit_access()
subuser_handler_field_user_link_edit::render in ./subuser_handler_field_user_link_edit.inc
1 string reference to 'subuser_user_edit_access'
subuser_menu_alter in ./subuser.module
Implementation of hook_menu_link_alter().

File

./subuser.module, line 104
Allows users of a particular role to create sub user account in another role.

Code

function subuser_user_edit_access($account) {

  // Condition from user_edit_access().
  if (($GLOBALS['user']->uid == $account->uid || user_access('administer users')) && $account->uid > 0) {
    return TRUE;
  }

  // Check if user can administer subusers and the user being editted is a
  // subuser of the active user.
  if (user_access('administer subusers') && db_result(db_query('SELECT uid FROM {subuser_relationship} WHERE uid = %d AND parent_id = %d', $account->uid, $GLOBALS['user']->uid))) {
    return TRUE;
  }
  return FALSE;
}