interface NodeAccessControlHandlerInterface (View source)

Node specific entity access control methods.

Methods

array
acquireGrants(NodeInterface $node)

Gets the list of node access grants.

writeGrants(NodeInterface $node, $delete = TRUE) deprecated

Writes a list of grants to the database, deleting any previously saved ones.

writeDefaultGrant()

Creates the default node access grant entry on the grant storage.

deleteGrants()

Deletes all node access entries.

int
countGrants()

Counts available node grants.

int
checkAllGrants(AccountInterface $account)

Checks all grants for a given account.

Details

array acquireGrants(NodeInterface $node)

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.

Parameters

NodeInterface $node

The $node to acquire grants for.

Return Value

array

The access rules for the node.

writeGrants(NodeInterface $node, $delete = TRUE) deprecated

deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants().

Writes a list of grants to the database, deleting any previously saved ones.

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 \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.

Parameters

NodeInterface $node

The node whose grants are being written.

$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.

writeDefaultGrant()

Creates the default node access grant entry on the grant storage.

deleteGrants()

Deletes all node access entries.

int countGrants()

Counts available node grants.

Return Value

int

Returns the amount of node grants.

int checkAllGrants(AccountInterface $account)

Checks all grants for a given account.

Parameters

AccountInterface $account

A user object representing the user for whom the operation is to be performed.

Return Value

int

Status of the access check.