function user_has_permission

7.x user_has_permission($permission = "", $account = NULL)
6.x user_has_permission($permission = "", $account = NULL)
4.x user_has_permission($permission)
5.x user_has_permission($permission, $account = NULL)

Returns TRUE or FALSE if the logged in user has access based on the permission supplied.


String $permission:

38 calls to user_has_permission()
admin_display_edit_degree in modules/admin/
This screen displays the form which allows the user to actually edit a degree.
admin_display_main in modules/admin/admin.module
This is the "main" page for the admin module. It's what the user first sees when the click to go to the Admin page.
admin_edit_group_form in modules/admin/
This function lets the user edit a group.
advise_can_access_view in modules/advise/advise.module
Used by the menu to determine if the user can see the View tab.
advise_display_history in modules/advise/
Displays the history tab on screen.

... See full list


includes/, line 1481
This file contains misc functions for FlightPath


function user_has_permission($permission) {
  global $user;

  //fpm("checking permission $permission");

  // If the user is admin (id == 1) then they always have access.
  if ($user->id == 1) {
    return TRUE;

  // Otherwise, simply check their permissions array.
  if (in_array($permission, $user->permissions)) {
    return TRUE;

  return FALSE;