NodeAccessControlHandler::writeGrants

public NodeAccessControlHandler::writeGrants(NodeInterface $node, $delete = TRUE)

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

\Drupal\node\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.

Overrides NodeAccessControlHandlerInterface::writeGrants

Deprecated

in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants().

File

core/modules/node/src/NodeAccessControlHandler.php, line 162

Class

NodeAccessControlHandler
Defines the access control handler for the node entity type.

Namespace

Drupal\node

Code

public function writeGrants(NodeInterface $node, $delete = TRUE) {
  $grants = $this->acquireGrants($node);
  $this->grantStorage->write($node, $grants, NULL, $delete);
}
doc_Drupal
2016-10-29 09:30:31
Comments
Leave a Comment

Please login to continue.