Added Entity and Entity Reference Revisions which got dropped somewhere along the...
[yaffs-website] / web / modules / contrib / entity / src / QueryAccess / QueryAccessHandlerInterface.php
1 <?php
2
3 namespace Drupal\entity\QueryAccess;
4
5 use Drupal\Core\Session\AccountInterface;
6
7 /**
8  * Query access handlers control access to entities in queries.
9  *
10  * An entity defines a query access handler in its annotation:
11  * @code
12  *   query_access = "\Drupal\entity\QueryAccess\QueryAccessHandler"
13  * @code
14  * The handler builds a set of conditions which are then applied to a query
15  * to filter it. For example, if the user #22 only has access to view
16  * their own entities, a uid = '22' condition will be built and applied.
17  *
18  * The following query types are supported:
19  * - Entity queries with the $entity_type_id . '_access' tag.
20  * - Views queries.
21  */
22 interface QueryAccessHandlerInterface {
23
24   /**
25    * Gets the conditions for the given operation and user.
26    *
27    * The "entity.query_access.$entity_type_id" event is fired to allow
28    * modules to alter the conditions.
29    *
30    * @param string $operation
31    *   The access operation. Usually one of "view", "update" or "delete".
32    * @param \Drupal\Core\Session\AccountInterface $account
33    *   The user for which to restrict access, or NULL
34    *   to assume the current user. Defaults to NULL.
35    *
36    * @return \Drupal\entity\QueryAccess\ConditionGroup
37    *   The conditions.
38    */
39   public function getConditions($operation, AccountInterface $account = NULL);
40
41 }