protected function FeatureAccessControlHandler::checkAccess in Configuration selector 8
Same name and namespace in other branches
- 8.2 src/Access/FeatureAccessControlHandler.php \Drupal\config_selector\Access\FeatureAccessControlHandler::checkAccess()
Performs access checks.
This method is supposed to be overwritten by extending classes that do their own custom access checking.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check access.
string $operation: The entity operation. Usually one of 'view', 'view label', 'update' or 'delete'.
\Drupal\Core\Session\AccountInterface $account: The user for which to check access.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
Overrides EntityAccessControlHandler::checkAccess
File
- src/
Access/ FeatureAccessControlHandler.php, line 20
Class
- FeatureAccessControlHandler
- Defines the access control handler for the feature entity type.
Namespace
Drupal\config_selector\AccessCode
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
switch ($operation) {
case 'view':
case 'manage':
return AccessResult::allowedIf($account
->hasPermission('administer site configuration'))
->cachePerPermissions();
// Leave plumbing for editing and deleting via the UI.
// @todo implement.
case 'update':
case 'delete':
return AccessResult::forbidden();
default:
// No opinion.
return AccessResult::neutral();
}
}