class NodeRevisionAccessCheck implements AccessInterface (View source)

Provides an access checker for node revisions.

Properties

protected NodeStorageInterface $nodeStorage

The node storage.

protected EntityAccessControlHandlerInterface $nodeAccess

The node access control handler.

protected array $access

A static cache of access checks.

Methods

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a new NodeRevisionAccessCheck.

access(Route $route, AccountInterface $account, int $node_revision = NULL, NodeInterface $node = NULL)

Checks routing access for the node revision.

bool
checkAccess(NodeInterface $node, AccountInterface $account, string $op = 'view')

Checks node revision access.

Details

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a new NodeRevisionAccessCheck.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

AccessResultInterface access(Route $route, AccountInterface $account, int $node_revision = NULL, NodeInterface $node = NULL)

Checks routing access for the node revision.

Parameters

Route $route

The route to check against.

AccountInterface $account

The currently logged in account.

int $node_revision

(optional) The node revision ID. If not specified, but $node is, access is checked for that object's revision.

NodeInterface $node

(optional) A node object. Used for checking access to a node's default revision when $node_revision is unspecified. Ignored when $node_revision is specified. If neither $node_revision nor $node are specified, then access is denied.

Return Value

AccessResultInterface

The access result.

bool checkAccess(NodeInterface $node, AccountInterface $account, string $op = 'view')

Checks node revision access.

Parameters

NodeInterface $node

The node to check.

AccountInterface $account

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

string $op

(optional) The specific operation being checked. Defaults to 'view.'

Return Value

bool

TRUE if the operation may be performed, FALSE otherwise.