class ContentAccessNodePageAccessCheck in Content Access 8
Class ContentAccessNodePageAccessCheck.
Determines access to routes based on permissions defined via $module.permissions.yml files.
Hierarchy
- class \Drupal\content_access\Access\ContentAccessNodePageAccessCheck implements AccessInterface
Expanded class hierarchy of ContentAccessNodePageAccessCheck
1 string reference to 'ContentAccessNodePageAccessCheck'
1 service uses ContentAccessNodePageAccessCheck
File
- src/
Access/ ContentAccessNodePageAccessCheck.php, line 16
Namespace
Drupal\content_access\AccessView source
class ContentAccessNodePageAccessCheck implements AccessInterface {
/**
* {@inheritdoc}
*/
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));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentAccessNodePageAccessCheck:: |
public | function |