You are here

interface AccessControlInterface in Group 2.0.x

Provides a common interface for group relation access control handlers.

Hierarchy

Expanded class hierarchy of AccessControlInterface

All classes that implement AccessControlInterface

2 files declare their use of AccessControlInterface
AccessControl.php in src/Plugin/Group/RelationHandlerDefault/AccessControl.php
GroupContentAccessControlHandlerTest.php in tests/src/Unit/GroupContentAccessControlHandlerTest.php

File

src/Plugin/Group/RelationHandler/AccessControlInterface.php, line 13

Namespace

Drupal\group\Plugin\Group\RelationHandler
View source
interface AccessControlInterface extends RelationHandlerInterface {

  /**
   * Checks access to an operation on the relation.
   *
   * @param \Drupal\group\Entity\GroupContentInterface $group_content
   *   The group content for which to check access.
   * @param string $operation
   *   The operation access should be checked for. Usually one of "view",
   *   "update" or "delete".
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user session for which to check access.
   * @param bool $return_as_object
   *   (optional) Defaults to FALSE.
   *
   * @return bool|\Drupal\Core\Access\AccessResultInterface
   *   The access result. Returns a boolean if $return_as_object is FALSE (this
   *   is the default) and otherwise an AccessResultInterface object.
   *   When a boolean is returned, the result of AccessInterface::isAllowed() is
   *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
   *   access is either explicitly forbidden or "no opinion".
   */
  public function relationAccess(GroupContentInterface $group_content, $operation, AccountInterface $account, $return_as_object = FALSE);

  /**
   * Checks access to create a relation.
   *
   * @param \Drupal\group\Entity\GroupInterface $group
   *   The group to check for group content create access.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user for which to check access.
   * @param bool $return_as_object
   *   (optional) Defaults to FALSE.
   *
   * @return bool|\Drupal\Core\Access\AccessResultInterface
   *   The access result. Returns a boolean if $return_as_object is FALSE (this
   *   is the default) and otherwise an AccessResultInterface object.
   *   When a boolean is returned, the result of AccessInterface::isAllowed() is
   *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
   *   access is either explicitly forbidden or "no opinion".
   */
  public function relationCreateAccess(GroupInterface $group, AccountInterface $account, $return_as_object = FALSE);

  /**
   * Checks access to an operation on the entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity for which to check access.
   * @param string $operation
   *   The operation access should be checked for. Usually one of "view",
   *   "update" or "delete".
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user session for which to check access.
   * @param bool $return_as_object
   *   (optional) Defaults to FALSE.
   *
   * @return bool|\Drupal\Core\Access\AccessResultInterface
   *   The access result. Returns a boolean if $return_as_object is FALSE (this
   *   is the default) and otherwise an AccessResultInterface object.
   *   When a boolean is returned, the result of AccessInterface::isAllowed() is
   *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
   *   access is either explicitly forbidden or "no opinion".
   */
  public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account, $return_as_object = FALSE);

  /**
   * Checks access to create an entity.
   *
   * @param \Drupal\group\Entity\GroupInterface $group
   *   The group to check for entity create access.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user for which to check access.
   * @param bool $return_as_object
   *   (optional) Defaults to FALSE.
   *
   * @return bool|\Drupal\Core\Access\AccessResultInterface
   *   The access result. Returns a boolean if $return_as_object is FALSE (this
   *   is the default) and otherwise an AccessResultInterface object.
   *   When a boolean is returned, the result of AccessInterface::isAllowed() is
   *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
   *   access is either explicitly forbidden or "no opinion".
   */
  public function entityCreateAccess(GroupInterface $group, AccountInterface $account, $return_as_object = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
AccessControlInterface::entityAccess public function Checks access to an operation on the entity.
AccessControlInterface::entityCreateAccess public function Checks access to create an entity.
AccessControlInterface::relationAccess public function Checks access to an operation on the relation.
AccessControlInterface::relationCreateAccess public function Checks access to create a relation.
RelationHandlerInterface::init public function Initializes the handler.