You are here

public function NodeGrantDatabaseStorageInterface::write in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/src/NodeGrantDatabaseStorageInterface.php \Drupal\node\NodeGrantDatabaseStorageInterface::write()

Writes a list of grants to the database, deleting 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 method when doing mass updates due to widespread permission changes.

Note: Don't call this method directly from a contributed module. Call \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.

Parameters

\Drupal\node\NodeInterface $node: The node whose grants are being written.

array $grants: A list of grants to write. Each grant is an array that must contain the following keys: realm, gid, grant_view, grant_update, grant_delete. The realm is specified by a particular module; the gid is as well, and is a module-defined id to define grant privileges. each grant_* field is a boolean value.

string $realm: (optional) If provided, read/write grants for that realm only. Defaults to NULL.

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

1 method overrides NodeGrantDatabaseStorageInterface::write()
NodeGrantDatabaseStorage::write in core/modules/node/src/NodeGrantDatabaseStorage.php
Writes a list of grants to the database, deleting previously saved ones.

File

core/modules/node/src/NodeGrantDatabaseStorageInterface.php, line 77

Class

NodeGrantDatabaseStorageInterface
Provides an interface for node access grant storage.

Namespace

Drupal\node

Code

public function write(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE);