user_access
- Versions
- 4.6 – 5
user_access($string, $account = NULL)- 6
user_access($string, $account = NULL,$reset= FALSE)- 7
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.
▾ 141 functions call user_access()
- aggregator_block_view in modules/aggregator/aggregator.module
- Implement hook_block_view().
- aggregator_categorize_items_validate in modules/aggregator/aggregator.pages.inc
- Validate aggregator_categorize_items() form submissions.
- 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
- Implement hook_block_view().
- blog_page_last in modules/blog/blog.pages.inc
- Menu callback; displays a Drupal page containing recent blog entries of all users.
- 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
- Implement 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
- Implement hook_form_alter().
- book_node_prepare in modules/book/book.module
- Implement hook_node_prepare().
- book_node_presave in modules/book/book.module
- Implement hook_node_presave().
- book_node_view_link in modules/book/book.module
- Inject links into $node as needed.
- 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
- Implement 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
- Implement hook_form_alter().
- comment_form_node_type_form_alter in modules/comment/comment.module
- Implement 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
- Implement 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.
- dashboard_admin in modules/dashboard/dashboard.module
- Dashboard page callback.
- field_test_entity_form in modules/simpletest/tests/field_test.module
- Form to set the value of fields attached to our entity.
- file_file_download in modules/file/file.module
- Implement 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
- Implement hook_permission().
- forum_block_view in modules/forum/forum.module
- Implement 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.
- locale_form_alter in modules/locale/locale.module
- Implement hook_form_alter().
- menu_form_alter in modules/menu/menu.module
- Implement hook_form_alter(). Adds menu item fields to the node form.
- menu_get_active_help in includes/menu.inc
- Returns the help associated with the active menu item.
- node_access in modules/node/node.module
- Determine whether the current user may perform the given operation on the specified node.
- node_access_example_node_access_explain in developer/examples/node_access_example.module
- Implementation of hook_node_access_explain().
- node_access_example_node_grants in developer/examples/node_access_example.module
- Implementation of hook_node_grants().
- node_example_access in developer/examples/node_example.module
- Implementation of hook_access().
- 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
- Implement hook_form_FORM_ID_alter().
- node_help in modules/node/node.module
- Implement hook_help().
- node_node_access in modules/node/node.module
- Implement hook_node_access().
- node_page_default in modules/node/node.module
- Menu callback; Generate a listing of promoted nodes.
- node_query_node_access_alter in modules/node/node.module
- Implement 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
- Implement hook_search_access().
- node_submit in modules/node/node.module
- Prepare node for save and allow modules to make changes.
- node_validate in modules/node/node.module
- Perform validation checks on the given node.
- 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
- Implement hook_form_alter().
- path_form_taxonomy_form_term_alter in modules/path/path.module
- Implement hook_form_FORM_ID_alter().
- poll_block_info in modules/poll/poll.module
- Implement hook_block_info().
- poll_block_view in modules/poll/poll.module
- Implement hook_block_view().
- poll_form in modules/poll/poll.module
- Implement hook_form().
- poll_insert in modules/poll/poll.module
- Implement hook_insert().
- poll_load in modules/poll/poll.module
- Implement hook_load().
- profile_block_view in modules/profile/profile.module
- Implement 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
- Implement hook_user_view().
- profile_view_field in modules/profile/profile.module
- search_block_view in modules/search/search.module
- Implement hook_block_view().
- 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
- Menu callback; Build 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
- Implement hook_block_view().
- statistics_node_view in modules/statistics/statistics.module
- Implement 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_preprocess in modules/system/system.module
- Template variable preprocessor for contextual links.
- 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 in includes/theme.inc
- Adds a default set of helper variables for variable processors and templates. This comes in before any other preprocess function which makes it possible to be used in default theme implementations (non-overriden theme functions).
- 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.
- toolbar_page_build in modules/toolbar/toolbar.module
- Implement hook_page_build().
- toolbar_preprocess_html in modules/toolbar/toolbar.module
- Implement hook_preprocess_html().
- translation_form_alter in modules/translation/translation.module
- Implement hook_form_alter().
- translation_node_prepare in modules/translation/translation.module
- Implement hook_node_prepare().
- update_help in modules/update/update.module
- Implement hook_help().
- update_manager_access in modules/update/update.module
- Determine if the current user can access the updater menu items.
- upload_file_download in modules/upload/upload.module
- Implement hook_file_download().
- upload_form_alter in modules/upload/upload.module
- upload_node_form_submit in modules/upload/upload.module
- Save new uploads and store them in the session to be associated to the node on upload_save.
- upload_node_insert in modules/upload/upload.module
- Implement hook_node_insert().
- upload_node_update in modules/upload/upload.module
- Implement hook_node_update().
- upload_node_view in modules/upload/upload.module
- Implement hook_node_view().
- 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
- Implement 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
- Implement hook_search_access().
- user_search_execute in modules/user/user.module
- Implement hook_search_execute().
- user_user_operations in modules/user/user.module
- Implement hook_user_operations().
- user_view_access in modules/user/user.module
- _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.
- _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.
- _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.
- _upload_form in modules/upload/upload.module
Code
modules/user/user.module, line 673
<?php
function user_access($string, $account = NULL) {
global $user;
$perm = &drupal_static(__FUNCTION__, array());
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.
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]);
}
?>Login or register to post comments 