interface EntityAccessControllerInterface

Defines a common interface for entity access controller classes.

Hierarchy

Expanded class hierarchy of EntityAccessControllerInterface

All classes that implement EntityAccessControllerInterface

1 file declares its use of EntityAccessControllerInterface
EntityTestAccessController.php in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php
Contains Drupal\entity_test\EntityTestAccessController.

File

drupal/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php, line 16
Contains Drupal\Core\Entity\EntityAccessControllerInterface.

Namespace

Drupal\Core\Entity
View source
interface EntityAccessControllerInterface {

  /**
   * Checks 'view' access for a given entity or entity translation.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity for which to check 'view' access.
   * @param string $langcode
   *   (optional) The language code for which to check access. Defaults to
   *   LANGUAGE_DEFAULT.
   * @param \Drupal\user\Plugin\Core\Entity\User $account
   *   (optional) The user for which to check access, or NULL to check access
   *   for the current user. Defaults to NULL.
   *
   * @return bool
   *   TRUE if access was granted, FALSE otherwise.
   */
  public function viewAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL);

  /**
   * Checks 'create' access for a given entity or entity translation.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity for which to check 'create' access.
   * @param string $langcode
   *   (optional) The language code for which to check access. Defaults to
   *   LANGUAGE_DEFAULT.
   * @param \Drupal\user\Plugin\Core\Entity\User $account
   *   (optional) The user for which to check access, or NULL to check access
   *   for the current user. Defaults to NULL.
   *
   * @return bool
   *   TRUE if access was granted, FALSE otherwise.
   */
  public function createAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL);

  /**
   * Checks 'update' access for a given entity or entity translation.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity to check 'update' access.
   * @param string $langcode
   *   (optional) The language code for which to check access. Defaults to
   *   LANGUAGE_DEFAULT.
   * @param \Drupal\user\Plugin\Core\Entity\User $account
   *   (optional) The user for which to check access, or NULL to check access
   *   for the current user. Defaults to NULL.
   *
   * @return bool
   *   TRUE if access was granted, FALSE otherwise.
   */
  public function updateAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL);

  /**
   * Checks 'delete' access for a given entity or entity translation.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity for which to check 'delete' access.
   * @param string $langcode
   *   (optional) The language code for which to check access. Defaults to
   *   LANGUAGE_DEFAULT.
   * @param \Drupal\user\Plugin\Core\Entity\User $account
   *   (optional) The user for which to check access, or NULL to check access
   *   for the current user. Defaults to NULL.
   *
   * @return bool
   *   TRUE if access was granted, FALSE otherwise.
   */
  public function deleteAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
EntityAccessControllerInterface::createAccess public function Checks 'create' access for a given entity or entity translation. 2
EntityAccessControllerInterface::deleteAccess public function Checks 'delete' access for a given entity or entity translation. 2
EntityAccessControllerInterface::updateAccess public function Checks 'update' access for a given entity or entity translation. 2
EntityAccessControllerInterface::viewAccess public function Checks 'view' access for a given entity or entity translation. 2