public function ContentAccessNodePageAccessCheck::access in Content Access 8
File
- src/
Access/ ContentAccessNodePageAccessCheck.php, line 21
Class
- ContentAccessNodePageAccessCheck
- Class ContentAccessNodePageAccessCheck.
Namespace
Drupal\content_access\AccessCode
public function access(AccountInterface $account, RouteMatchInterface $route_match) {
$node = $route_match
->getParameter('node');
$all_nodes_access = $account
->hasPermission('grant content access');
$own_node_access = $account
->hasPermission('grant own content access') && $account
->id() == $node
->getOwnerId();
return AccessResult::allowedIf(content_access_get_settings('per_node', $node
->getType()) && ($all_nodes_access || $own_node_access));
}