user_access

Versions
mediamosa-21
user_access($string, $account = NULL)

Determine whether the user has a given privilege.

All permission checks in Drupal should go through this function. This way, we guarantee consistent behavior, and ensure that the superuser can perform all actions.

Parameters

$string The permission, such as "administer nodes", being checked for.

$account (optional) The account to check, if not given use currently logged in user.

Return value

Boolean TRUE if the current user has the requested permission.

▾ 156 functions call user_access()

aggregator_block_view in modules/aggregator/aggregator.module
Implements hook_block_view().
authorize_access_allowed in ./authorize.php
Determine if the current user is allowed to run authorize.php.
block_admin_configure in modules/block/block.admin.inc
Menu callback; displays the block configuration form.
blog_block_view in modules/blog/blog.module
Implements hook_block_view().
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
blog_page_user_access in modules/blog/blog.module
Access callback for user blog pages.
blog_user_view in modules/blog/blog.module
Implements hook_user_view().
book_export_html in modules/book/book.pages.inc
This function is called by book_export() to generate HTML for export.
book_form_alter in modules/book/book.module
Implements hook_form_alter().
book_node_prepare in modules/book/book.module
Implements hook_node_prepare().
book_node_presave in modules/book/book.module
Implements hook_node_presave().
book_node_view_link in modules/book/book.module
Inject links into $node as needed.
coder_review_form_alter in sites/all/modules/coder/coder_review/coder_review.module
Implements hook_form_alter().
comment_access in modules/comment/comment.module
This is *not* a hook_access() implementation. This function is called to determine whether the current user has access to a particular comment.
comment_block_view in modules/comment/comment.module
Implements hook_block_view().
comment_form in modules/comment/comment.module
Generate the basic commenting form, for appending to a node or display on a separate page.
comment_form_alter in modules/comment/comment.module
Implements hook_form_alter().
comment_form_node_type_form_alter in modules/comment/comment.module
Implements hook_form_FORM_ID_alter().
comment_form_submit in modules/comment/comment.module
Process comment form submissions; prepare the comment, store it, and set a redirection target.
comment_get_display_ordinal in modules/comment/comment.module
Get the display ordinal for a comment, starting from 0.
comment_get_thread in modules/comment/comment.module
Retrieve comments for a thread.
comment_links in modules/comment/comment.module
Helper function, build links for an individual comment.
comment_node_page_additions in modules/comment/comment.module
Build the comment-related elements for node detail pages.
comment_node_view in modules/comment/comment.module
Implements hook_node_view().
comment_reply in modules/comment/comment.pages.inc
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
comment_save in modules/comment/comment.module
Accepts a submission of new or changed comment content.
contact_personal_form in modules/contact/contact.pages.inc
Form builder; the personal contact form.
contact_personal_form_submit in modules/contact/contact.pages.inc
Form submission handler for contact_personal_form().
contact_site_form in modules/contact/contact.pages.inc
Form builder; the site-wide contact form.
contextual_preprocess in modules/contextual/contextual.module
Template variable preprocessor for contextual links.
dashboard_admin in modules/dashboard/dashboard.module
Dashboard page callback.
ddebug_backtrace in sites/all/modules/devel/devel.module
Print the function call stack.
devel_block_view in sites/all/modules/devel/devel.module
devel_exit in sites/all/modules/devel/devel.module
devel_form_alter in sites/all/modules/devel/devel.module
TODO: I switched params as per http://drupal.org/node/144132#form-alter but needs work still Implements hook_form_alter().
devel_init in sites/all/modules/devel/devel.module
Implements hook_init().
devel_node_access_block_view in sites/all/modules/devel/devel_node_access.module
devel_page_alter in sites/all/modules/devel/devel.module
devel_shutdown_real in sites/all/modules/devel/devel.module
See devel_shutdown() which registers this function as a shutdown function. Displays developer information in the footer.
devel_switch_user_list in sites/all/modules/devel/devel.module
devel_themer_catch_function in sites/all/modules/devel/devel_themer.module
Intercepts all theme calls (including templates), adds to template log, and dispatches to original theme function. This function gets injected into theme registry in devel_exit().
devel_themer_init in sites/all/modules/devel/devel_themer.module
dfb in sites/all/modules/devel/devel.module
Calls the http://www.firephp.org/ fb() function if it is found.
dpm in sites/all/modules/devel/devel.module
Print a variable to the 'message' area of the page. Uses drupal_set_message()
dprint_r in sites/all/modules/devel/devel.module
Pretty-print a variable to the browser (no krumo). Displays only for users with proper permissions. If you want a string returned instead of a print, use the 2nd param.
dvm in sites/all/modules/devel/devel.module
Var_dump() a variable to the 'message' area of the page. Uses drupal_set_message()
field_test_entity_form in modules/field/tests/field_test.entity.inc
Test_entity form.
file_file_download in modules/file/file.module
Implements hook_file_download().
filter_access in modules/filter/filter.module
Checks if a user has access to a particular text format.
filter_permission in modules/filter/filter.module
Implements hook_permission().
forum_block_view in modules/forum/forum.module
Implements hook_block_view().
hook_file_download in modules/system/system.api.php
Control access to private file downloads and specify HTTP headers.
hook_node_access in modules/node/node.api.php
Control access to a node.
hook_node_grants in modules/node/node.api.php
Inform the node access system what permissions the user has.
hook_query_TAG_alter in modules/system/system.api.php
Perform alterations to a structured query for a given tag.
hook_search_access in modules/search/search.api.php
Define access to a custom search routine.
hook_user_cancel_methods_alter in modules/user/user.api.php
Modify account cancellation methods.
hook_user_view in modules/user/user.api.php
The user's account information is being displayed.
kprint_r in sites/all/modules/devel/devel.module
locale_language_selector_form in modules/locale/locale.module
Form builder callback to display language selection widget.
mediamosa_configuration_storage_form_submit in sites/all/modules/mediamosa/configuration/storage/mediamosa_configuration_storage.module
mediamosa_integrity_check_start_submit in sites/all/modules/mediamosa/modules/integrity_check/mediamosa_integrity_check.module
Submit.
menu_form_alter in modules/menu/menu.module
Implements hook_form_alter(). Adds menu item fields to the node form.
node_access in modules/node/node.module
Determine whether the current user may perform the given operation on the specified node.
node_access_test_node_grants in modules/node/tests/node_access_test.module
Implements hook_node_grants().
node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_block_view in modules/node/node.module
Implements hook_block_view().
node_form in modules/node/node.pages.inc
Generate the node add/edit form array.
node_form_search_form_alter in modules/node/node.module
Implements hook_form_FORM_ID_alter().
node_get_recent in modules/node/node.module
Find the most recent nodes that are available to the current user.
node_help in modules/node/node.module
Implements hook_help().
node_node_access in modules/node/node.module
Implements hook_node_access().
node_query_node_access_alter in modules/node/node.module
Implements hook_query_TAG_alter().
node_revision_overview in modules/node/node.pages.inc
Generate an overview table of older revisions of a node.
node_search_access in modules/node/node.module
Implements hook_search_access().
overlay_init in modules/overlay/overlay.module
Implements hook_init().
path_admin_delete_confirm in modules/path/path.admin.inc
Menu callback; confirms deleting an URL alias
path_form_alter in modules/path/path.module
Implements hook_form_alter().
path_form_taxonomy_form_term_alter in modules/path/path.module
Implements hook_form_FORM_ID_alter().
poll_block_info in modules/poll/poll.module
Implements hook_block_info().
poll_block_view in modules/poll/poll.module
Implements hook_block_view().
poll_form in modules/poll/poll.module
Implements hook_form().
poll_insert in modules/poll/poll.module
Implements hook_insert().
poll_load in modules/poll/poll.module
Implements hook_load().
profile_block_view in modules/profile/profile.module
Implements hook_block_view().
profile_browse in modules/profile/profile.pages.inc
Menu callback; display a list of user information.
profile_category_access in modules/profile/profile.module
Menu item access callback - check if a user has access to a profile category.
profile_user_form_validate in modules/profile/profile.module
Form validation handler for the user register/profile form.
profile_user_view in modules/profile/profile.module
Implements hook_user_view().
profile_view_field in modules/profile/profile.module
rdf_preprocess_node in modules/rdf/rdf.module
Implements MODULE_preprocess_HOOK().
search_block_view in modules/search/search.module
Implements hook_block_view().
shortcut_help in modules/shortcut/shortcut.module
Implements hook_help().
shortcut_set_delete_access in modules/shortcut/shortcut.module
Access callback for deleting a shortcut set.
shortcut_set_edit_access in modules/shortcut/shortcut.module
Access callback for editing a shortcut set.
shortcut_set_switch in modules/shortcut/shortcut.admin.inc
Form callback: builds the form for switching shortcut sets.
shortcut_set_switch_access in modules/shortcut/shortcut.module
Access callback for switching the shortcut set assigned to a user account.
statistics_block_view in modules/statistics/statistics.module
Implements hook_block_view().
statistics_node_view in modules/statistics/statistics.module
Implements hook_node_view().
statistics_top_visitors in modules/statistics/statistics.admin.inc
Menu callback; presents the "top visitors" page.
system_admin_config_page in modules/system/system.admin.inc
Menu callback; Provide the administration overview page.
system_get_module_admin_tasks in modules/system/system.module
Generate a list of tasks offered by a specified module.
system_main_admin_page in modules/system/system.admin.inc
Menu callback; Provide the administration overview page.
system_modules in modules/system/system.admin.inc
Menu callback; provides module enable/disable interface.
taxonomy_form_term in modules/taxonomy/taxonomy.admin.inc
Form function for the term edit form.
taxonomy_term_edit_access in modules/taxonomy/taxonomy.module
Return edit access for a given term.
template_preprocess_aggregator_feed_source in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-feed-source.tpl.php.
template_preprocess_poll_results in modules/poll/poll.module
Preprocess the poll_results theme hook.
template_preprocess_username in includes/theme.inc
Preprocess variables for theme_username().
template_preprocess_user_picture in modules/user/user.module
Process variables for user-picture.tpl.php.
theme_book_admin_table in modules/book/book.admin.inc
Theme function for the book administration page form.
theme_node_recent_block in modules/node/node.module
Returns a formatted list of recent nodes.
toolbar_page_build in modules/toolbar/toolbar.module
Implements hook_page_build().
toolbar_preprocess_html in modules/toolbar/toolbar.module
Implements hook_preprocess_html().
translation_form_alter in modules/translation/translation.module
Implements hook_form_alter().
translation_node_prepare in modules/translation/translation.module
Implements hook_node_prepare().
update_access_allowed in ./update.php
Determines if the current user is allowed to run update.php.
update_help in modules/update/update.module
Implements hook_help().
update_manager_access in modules/update/update.module
Determine if the current user can access the updater menu items.
user_account_form in modules/user/user.module
Helper function to add default user account fields to user registration and edit form.
user_block_view in modules/user/user.module
Implements hook_block_view().
user_build_filter_query in modules/user/user.module
Extends a query object for user administration filters based on session.
user_cancel_access in modules/user/user.module
Menu access callback; limit access to account cancellation pages.
user_cancel_confirm_form in modules/user/user.pages.inc
Form builder; confirm form for cancelling user account.
user_cancel_confirm_form_submit in modules/user/user.pages.inc
Submit handler for the account cancellation confirm form.
user_cancel_methods in modules/user/user.pages.inc
Helper function to return available account cancellation methods.
user_edit_access in modules/user/user.module
Access callback for user account editing.
user_profile_form in modules/user/user.pages.inc
Form builder; edit a user account or one of their profile categories.
user_register_form in modules/user/user.module
Form builder; the user registration form.
user_register_submit in modules/user/user.module
Submit handler for the user registration form.
user_save in modules/user/user.module
Save changes to a user account or add a new user.
user_search_access in modules/user/user.module
Implements hook_search_access().
user_search_execute in modules/user/user.module
Implements hook_search_execute().
user_user_operations in modules/user/user.module
Implements hook_user_operations().
user_view_access in modules/user/user.module
User view access callback.
_aggregator_has_categories in modules/aggregator/aggregator.module
Find out whether there are any aggregator categories.
_aggregator_page_list in modules/aggregator/aggregator.pages.inc
Prints an aggregator page listing a number of feed items.
_block_themes_access in modules/block/block.module
Menu item access callback - only admin or enabled themes can be accessed.
_book_add_form_elements in modules/book/book.module
Build the common elements of the book form for the node and outline forms.
_book_outline_access in modules/book/book.module
Menu item access callback - determine if the outline tab is accessible.
_contact_personal_tab_access in modules/contact/contact.module
Menu access callback for a user's personal contact form.
_filter_delete_format_access in modules/filter/filter.module
Access callback for deleting text formats.
_mediamosa_browse_asset_page_view_mediafile_list in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Build the mediafile listing.
_menu_check_access in includes/menu.inc
Check access to a menu item using the access callback
_menu_site_is_offline in includes/menu.inc
Checks whether the site is in maintenance mode.
_node_add_access in modules/node/node.module
_node_revision_access in modules/node/node.module
_poll_choice_form in modules/poll/poll.module
_poll_menu_access in modules/poll/poll.module
Callback function to see if a node is acceptable for poll menu items.
_profile_get_fields in modules/profile/profile.module
_search_menu_access in modules/search/search.module
Access callback for search tabs.
_system_themes_access in modules/system/system.module
Menu item access callback - only admin or enabled themes can be accessed.
_template_preprocess_default_variables in includes/theme.inc
Returns hook-independant variables to template_preprocess().
_tracker_myrecent_access in modules/tracker/tracker.module
Access callback for tracker/%user_uid_optional.
_tracker_user_access in modules/tracker/tracker.module
Access callback for user/%user/track.
_translation_tab_access in modules/translation/translation.module
Menu access callback.

Code

modules/user/user.module, line 684

<?php
function user_access($string, $account = NULL) {
  global $user;

  if (!isset($account)) {
    $account = $user;
  }

  // User #1 has all privileges:
  if ($account->uid == 1) {
    return TRUE;
  }

  // To reduce the number of SQL queries, we cache the user's permissions
  // in a static variable.
  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__);
  }
  $perm = &$drupal_static_fast['perm'];
  if (!isset($perm[$account->uid])) {
    $role_permissions = user_role_permissions($account->roles);

    $perms = array();
    foreach ($role_permissions as $one_role) {
      $perms += $one_role;
    }
    $perm[$account->uid] = $perms;
  }

  return isset($perm[$account->uid][$string]);
}
?>