class ContentAccessAdminSettingsAccessCheck in Content Access 8
Class ContentAccessAdminSettingsAccessCheck.
Determines access to routes based on permissions defined via $module.permissions.yml files.
Hierarchy
- class \Drupal\content_access\Access\ContentAccessAdminSettingsAccessCheck implements AccessInterface
Expanded class hierarchy of ContentAccessAdminSettingsAccessCheck
1 string reference to 'ContentAccessAdminSettingsAccessCheck'
1 service uses ContentAccessAdminSettingsAccessCheck
File
- src/
Access/ ContentAccessAdminSettingsAccessCheck.php, line 17
Namespace
Drupal\content_access\AccessView source
class ContentAccessAdminSettingsAccessCheck implements AccessInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a ContentAccessAdminSettingsAccessCheck object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentAccessAdminSettingsAccessCheck:: |
protected | property | The entity type manager. | |
ContentAccessAdminSettingsAccessCheck:: |
public | function | ||
ContentAccessAdminSettingsAccessCheck:: |
public | function | Constructs a ContentAccessAdminSettingsAccessCheck object. |