You are here

class NodeRevisionAccessCheck in Node authorize link 8

Class NodeRevisionAccessCheck

@package Drupal\node_authlink\Access

Hierarchy

Expanded class hierarchy of NodeRevisionAccessCheck

1 string reference to 'NodeRevisionAccessCheck'
node_authlink.services.yml in ./node_authlink.services.yml
node_authlink.services.yml
1 service uses NodeRevisionAccessCheck
access_check.node.revision.decorate in ./node_authlink.services.yml
Drupal\node_authlink\Access\NodeRevisionAccessCheck

File

src/Access/NodeRevisionAccessCheck.php, line 16

Namespace

Drupal\node_authlink\Access
View source
class NodeRevisionAccessCheck extends NodeRevisionAccessCheckOriginal {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NodeRevisionAccessCheck::$access protected property A static cache of access checks.
NodeRevisionAccessCheck::$nodeAccess protected property The node access control handler.
NodeRevisionAccessCheck::$nodeStorage protected property The node storage.
NodeRevisionAccessCheck::access public function Checks routing access for the node revision.
NodeRevisionAccessCheck::checkAccess public function Checks node revision access. Overrides NodeRevisionAccessCheck::checkAccess
NodeRevisionAccessCheck::__construct public function Constructs a new NodeRevisionAccessCheck.