You are here

interface NodeAccessControlHandlerInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/NodeAccessControlHandlerInterface.php \Drupal\node\NodeAccessControlHandlerInterface

Node specific entity access control methods.

Hierarchy

Expanded class hierarchy of NodeAccessControlHandlerInterface

All classes that implement NodeAccessControlHandlerInterface

Related topics

File

core/modules/node/src/NodeAccessControlHandlerInterface.php, line 16
Contains \Drupal\node\NodeAccessControlHandlerInterface.

Namespace

Drupal\node
View source
interface NodeAccessControlHandlerInterface {

  /**
   * Gets the list of node access grants.
   *
   * This function is called to check the access grants for a node. It collects
   * all node access grants for the node from hook_node_access_records()
   * implementations, allows these grants to be altered via
   * hook_node_access_records_alter() implementations, and returns the grants to
   * the caller.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The $node to acquire grants for.
   *
   * @return array $grants
   *   The access rules for the node.
   */
  public function acquireGrants(NodeInterface $node);

  /**
   * Writes a list of grants to the database, deleting any previously saved ones.
   *
   * If a realm is provided, it will only delete grants from that realm, but it
   * will always delete a grant from the 'all' realm. Modules that use node
   * access can use this function when doing mass updates due to widespread
   * permission changes.
   *
   * Note: Don't call this function directly from a contributed module. Call
   * node_access_acquire_grants() instead.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node whose grants are being written.
   * @param $delete
   *   (optional) If false, does not delete records. This is only for optimization
   *   purposes, and assumes the caller has already performed a mass delete of
   *   some form. Defaults to TRUE.
   */
  public function writeGrants(NodeInterface $node, $delete = TRUE);

  /**
   * Creates the default node access grant entry on the grant storage.
   */
  public function writeDefaultGrant();

  /**
   * Deletes all node access entries.
   */
  public function deleteGrants();

  /**
   * Counts available node grants.
   *
   * @return int
   *   Returns the amount of node grants.
   */
  public function countGrants();

  /**
   * Checks all grants for a given account.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   A user object representing the user for whom the operation is to be
   *   performed.
   *
   * @return int.
   *   Status of the access check.
   */
  public function checkAllGrants(AccountInterface $account);

}

Members

Namesort descending Modifiers Type Description Overrides
NodeAccessControlHandlerInterface::acquireGrants public function Gets the list of node access grants. 1
NodeAccessControlHandlerInterface::checkAllGrants public function Checks all grants for a given account. 1
NodeAccessControlHandlerInterface::countGrants public function Counts available node grants. 1
NodeAccessControlHandlerInterface::deleteGrants public function Deletes all node access entries. 1
NodeAccessControlHandlerInterface::writeDefaultGrant public function Creates the default node access grant entry on the grant storage. 1
NodeAccessControlHandlerInterface::writeGrants public function Writes a list of grants to the database, deleting any previously saved ones. 1