You are here

public function ContentAccessAdminSettingsAccessCheck::access in Content Access 8

File

src/Access/ContentAccessAdminSettingsAccessCheck.php, line 39

Class

ContentAccessAdminSettingsAccessCheck
Class ContentAccessAdminSettingsAccessCheck.

Namespace

Drupal\content_access\Access

Code

public function access(AccountInterface $account, RouteMatchInterface $route_match) {
  $node_type_id = $route_match
    ->getParameter('node_type');
  $node_type = $this->entityTypeManager
    ->getStorage('node_type')
    ->load($node_type_id);
  $permission_match = $account
    ->hasPermission('bypass node access') && $account
    ->hasPermission('administer content types');
  return AccessResult::allowedIf($permission_match && $node_type);
}