Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\node;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Session\AccountInterface;
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * Node specific entity access control methods.
|
Chris@0
|
9 *
|
Chris@0
|
10 * @ingroup node_access
|
Chris@0
|
11 */
|
Chris@0
|
12 interface NodeAccessControlHandlerInterface {
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Gets the list of node access grants.
|
Chris@0
|
16 *
|
Chris@0
|
17 * This function is called to check the access grants for a node. It collects
|
Chris@0
|
18 * all node access grants for the node from hook_node_access_records()
|
Chris@0
|
19 * implementations, allows these grants to be altered via
|
Chris@0
|
20 * hook_node_access_records_alter() implementations, and returns the grants to
|
Chris@0
|
21 * the caller.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @param \Drupal\node\NodeInterface $node
|
Chris@0
|
24 * The $node to acquire grants for.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @return array
|
Chris@0
|
27 * The access rules for the node.
|
Chris@0
|
28 */
|
Chris@0
|
29 public function acquireGrants(NodeInterface $node);
|
Chris@0
|
30
|
Chris@0
|
31 /**
|
Chris@0
|
32 * Writes a list of grants to the database, deleting any previously saved ones.
|
Chris@0
|
33 *
|
Chris@0
|
34 * Modules that use node access can use this function when doing mass updates
|
Chris@0
|
35 * due to widespread permission changes.
|
Chris@0
|
36 *
|
Chris@0
|
37 * Note: Don't call this function directly from a contributed module. Call
|
Chris@0
|
38 * \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.
|
Chris@0
|
39 *
|
Chris@0
|
40 * @param \Drupal\node\NodeInterface $node
|
Chris@0
|
41 * The node whose grants are being written.
|
Chris@0
|
42 * @param $delete
|
Chris@0
|
43 * (optional) If false, does not delete records. This is only for optimization
|
Chris@0
|
44 * purposes, and assumes the caller has already performed a mass delete of
|
Chris@0
|
45 * some form. Defaults to TRUE.
|
Chris@0
|
46 *
|
Chris@0
|
47 * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
|
Chris@0
|
48 * Use \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants().
|
Chris@0
|
49 */
|
Chris@0
|
50 public function writeGrants(NodeInterface $node, $delete = TRUE);
|
Chris@0
|
51
|
Chris@0
|
52 /**
|
Chris@0
|
53 * Creates the default node access grant entry on the grant storage.
|
Chris@0
|
54 */
|
Chris@0
|
55 public function writeDefaultGrant();
|
Chris@0
|
56
|
Chris@0
|
57 /**
|
Chris@0
|
58 * Deletes all node access entries.
|
Chris@0
|
59 */
|
Chris@0
|
60 public function deleteGrants();
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * Counts available node grants.
|
Chris@0
|
64 *
|
Chris@0
|
65 * @return int
|
Chris@0
|
66 * Returns the amount of node grants.
|
Chris@0
|
67 */
|
Chris@0
|
68 public function countGrants();
|
Chris@0
|
69
|
Chris@0
|
70 /**
|
Chris@0
|
71 * Checks all grants for a given account.
|
Chris@0
|
72 *
|
Chris@0
|
73 * @param \Drupal\Core\Session\AccountInterface $account
|
Chris@0
|
74 * A user object representing the user for whom the operation is to be
|
Chris@0
|
75 * performed.
|
Chris@0
|
76 *
|
Chris@0
|
77 * @return int
|
Chris@0
|
78 * Status of the access check.
|
Chris@0
|
79 */
|
Chris@0
|
80 public function checkAllGrants(AccountInterface $account);
|
Chris@0
|
81
|
Chris@0
|
82 }
|