You are here

function user_tools_find_first_permission in Module Grants 6.4

Same name and namespace in other branches
  1. 6.3 user_tools/user_tools.module \user_tools_find_first_permission()
2 calls to user_tools_find_first_permission()
user_tools_user_any_access in user_tools/user_tools.module
Return if the user account has at least one of the supplied permissions.
_module_grants_monitor_accessible_content_summary in module_grants_monitor/module_grants_monitor.module
Similar to module_grants_monitor_accessible_content_summary (which it calls) but with a different parameter list based on the (lack of) default tabs, as opposed to content properties.

File

user_tools/user_tools.module, line 41
Generic reusable functions involving user objects.

Code

function user_tools_find_first_permission($permissions, $account = NULL) {
  if (is_array($permissions)) {
    foreach ($permissions as $permission) {
      if (user_access($permission, $account)) {
        return $permission;
      }
    }
  }
  else {

    // return user_access($permissions, $account);
  }
  return NULL;
}