function NodeRevisionAccessCheck::checkAccess
Same name in other branches
- 8.9.x core/modules/node/src/Access/NodeRevisionAccessCheck.php \Drupal\node\Access\NodeRevisionAccessCheck::checkAccess()
Checks node revision access.
Parameters
\Drupal\node\NodeInterface $node: The node to check.
\Drupal\Core\Session\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.
File
-
core/
modules/ node/ src/ Access/ NodeRevisionAccessCheck.php, line 79
Class
- NodeRevisionAccessCheck
- Provides an access checker for node revisions.
Namespace
Drupal\node\AccessCode
public function checkAccess(NodeInterface $node, AccountInterface $account, $op = 'view') {
// Converts legacy operations for this access check to new revision
// operation found in access control handler.
$entity_operation_map = [
'view' => 'view all revisions',
'update' => 'revert revision',
'delete' => 'delete revision',
];
return isset($entity_operation_map[$op]) ? $node->access($entity_operation_map[$op], $account) : FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.