5 use Drupal\Core\Session\AccountInterface;
8 * Node specific entity access control methods.
10 * @ingroup node_access
12 interface NodeAccessControlHandlerInterface {
15 * Gets the list of node access grants.
17 * This function is called to check the access grants for a node. It collects
18 * all node access grants for the node from hook_node_access_records()
19 * implementations, allows these grants to be altered via
20 * hook_node_access_records_alter() implementations, and returns the grants to
23 * @param \Drupal\node\NodeInterface $node
24 * The $node to acquire grants for.
27 * The access rules for the node.
29 public function acquireGrants(NodeInterface $node);
32 * Writes a list of grants to the database, deleting any previously saved ones.
34 * Modules that use node access can use this function when doing mass updates
35 * due to widespread permission changes.
37 * Note: Don't call this function directly from a contributed module. Call
38 * \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.
40 * @param \Drupal\node\NodeInterface $node
41 * The node whose grants are being written.
43 * (optional) If false, does not delete records. This is only for optimization
44 * purposes, and assumes the caller has already performed a mass delete of
45 * some form. Defaults to TRUE.
47 * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
48 * Use \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants().
50 public function writeGrants(NodeInterface $node, $delete = TRUE);
53 * Creates the default node access grant entry on the grant storage.
55 public function writeDefaultGrant();
58 * Deletes all node access entries.
60 public function deleteGrants();
63 * Counts available node grants.
66 * Returns the amount of node grants.
68 public function countGrants();
71 * Checks all grants for a given account.
73 * @param \Drupal\Core\Session\AccountInterface $account
74 * A user object representing the user for whom the operation is to be
78 * Status of the access check.
80 public function checkAllGrants(AccountInterface $account);