function role_delegation_access in Role Delegation 6
Same name and namespace in other branches
- 7 role_delegation.module \role_delegation_access()
Access callback for menu hook.
1 string reference to 'role_delegation_access'
- role_delegation_menu in ./role_delegation.module 
- Implementation of hook_menu().
File
- ./role_delegation.module, line 121 
- This module allows site administrators to grant some roles the authority to assign selected roles to users, without them needing the 'administer access control' permission.
Code
function role_delegation_access() {
  // Check access to user profile page.
  if (!user_access('access user profiles')) {
    return FALSE;
  }
  // Check if they can edit users. In that case, the Roles tab is not needed.
  if (user_access('administer users')) {
    return FALSE;
  }
  // Check access to role assignment page.
  if (user_access('administer permissions')) {
    return TRUE;
  }
  $perms = role_delegation_perm();
  foreach ($perms as $perm) {
    if (user_access($perm)) {
      return TRUE;
    }
  }
  return FALSE;
}