You are here

public function NodeRevisionAccessCheck::checkAccess in Node authorize link 8

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.

Overrides NodeRevisionAccessCheck::checkAccess

File

src/Access/NodeRevisionAccessCheck.php, line 21

Class

NodeRevisionAccessCheck
Class NodeRevisionAccessCheck

Namespace

Drupal\node_authlink\Access

Code

public function checkAccess(NodeInterface $node, AccountInterface $account, $op = 'view') {
  if (!$node
    ->isDefaultRevision() && node_authlink_node_is_enabled($node) && node_authlink_check_authlink($node, $op, $account)) {
    $result = AccessResult::allowed();
  }
  else {
    $result = parent::checkAccess($node, $account, $op);
  }
  if ($result instanceof AccessResultInterface) {
    $result
      ->cachePerUser();
  }
  return $result;
}