function entity_access

cis7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)
cle7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)
elmsmedia7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)
icor7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)
meedjum_blog7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)
mooc7 entity.module entity_access($op, $entity_type, $entity = NULL, $account = NULL)

Determines whether the given user can perform actions on an entity.

For create operations, the pattern is to create an entity and then check if the user has create access.

$node = entity_create('node', array('type' => 'page'));
$access = entity_access('create', 'node', $node, $account);

Parameters

$op: The operation being performed. One of 'view', 'update', 'create' or 'delete'.

$entity_type: The entity type of the entity to check for.

$entity: Optionally an entity to check access for. If no entity is given, it will be determined whether access is allowed for all entities of the given type.

$account: The user to check for. Leave it to NULL to check for the global user.

Return value

boolean Whether access is allowed or not. If the entity type does not specify any access information, NULL is returned.

See also

entity_type_supports()

26 calls to entity_access()
cis_service_connection_block_section_outline in sites/all/modules/elmsln_contrib/cis_connector/modules/cis_service_connection/cis_service_connection.module
Render a block based on section context
email_mail_page_access in sites/all/modules/ulmus/email/email.module
Access callback for the email contact page.
EntityDrupalWrapper::entityAccess in sites/all/modules/ulmus/entity/includes/entity.wrapper.inc
Checks whether the operation $op is allowed on the entity.
entityreference_autocomplete_callback_get_matches in sites/all/modules/ulmus/entityreference/entityreference.module
Return JSON based on given field, instance and string.
entityreference_field_formatter_prepare_view in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_field_formatter_prepare_view().

... See full list

4 string references to 'entity_access'
EntityBundleableUIController::hook_menu in sites/all/modules/ulmus/entity/includes/entity.ui.inc
Provides definitions for implementing hook_menu().
EntityContentUIController::hook_menu in sites/all/modules/ulmus/entity/includes/entity.ui.inc
Provides definitions for implementing hook_menu().
EntityDefaultUIController::hook_menu in sites/all/modules/ulmus/entity/includes/entity.ui.inc
Provides definitions for implementing hook_menu().
og-7.x-1.x.database.php in sites/all/modules/ulmus/og/tests/og-7.x-1.x.database.php
Filled installation of Drupal 7.0, for test purposes.

File

sites/all/modules/ulmus/entity/entity.module, line 655
Module file for the entity API.

Code

function entity_access($op, $entity_type, $entity = NULL, $account = NULL) {
  if (($info = entity_get_info()) && isset($info[$entity_type]['access callback'])) {
    return $info[$entity_type]['access callback']($op, $entity, $account, $entity_type);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.