You are here

public function AccessCheck::handleNode in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 src/Service/AccessCheck.php \Drupal\permissions_by_term\Service\AccessCheck::handleNode()

Parameters

string $nodeId:

string $langcode:

Return value

AccessResult

File

src/Service/AccessCheck.php, line 200

Class

AccessCheck
AccessCheckService class.

Namespace

Drupal\permissions_by_term\Service

Code

public function handleNode($nodeId, $langcode) {
  if ($this
    ->canUserAccessByNodeId($nodeId, false, $langcode) === TRUE) {
    return AccessResult::neutral();
  }
  else {
    $accessDeniedEvent = new PermissionsByTermDeniedEvent($nodeId);
    $this->eventDispatcher
      ->dispatch(PermissionsByTermDeniedEvent::NAME, $accessDeniedEvent);
    return AccessResult::forbidden();
  }
}