class EntityPermissionsRouteProviderWithCheck in Drupal 10
Provides routes for the entity permissions form with a custom access check.
Use this class or EntityPermissionsRouteProvider as a route provider for an entity type such as BlockContentType. Either one will provide routes for the entity permissions form. This class provides a custom access check: it denies access if there are no entity-specific permissions. If you know that each entity has permissions, or if the check is too expensive, then use EntityPermissionsRouteProvider instead of this class.
Hierarchy
- class \Drupal\user\Entity\EntityPermissionsRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\user\Entity\EntityPermissionsRouteProviderWithCheck
Expanded class hierarchy of EntityPermissionsRouteProviderWithCheck
File
- core/
modules/ user/ src/ Entity/ EntityPermissionsRouteProviderWithCheck.php, line 18
Namespace
Drupal\user\EntityView source
class EntityPermissionsRouteProviderWithCheck extends EntityPermissionsRouteProvider {
/**
* {@inheritdoc}
*/
protected function getEntityPermissionsRoute(EntityTypeInterface $entity_type) : ?Route {
$route = parent::getEntityPermissionsRoute($entity_type);
if ($route) {
$route
->setRequirement('_custom_access', '\\Drupal\\user\\Form\\EntityPermissionsForm::access');
}
return $route;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityPermissionsRouteProvider:: |
protected | property | The entity type manager. | |
EntityPermissionsRouteProvider:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
|
EntityPermissionsRouteProvider:: |
public | function |
Provides routes for entities. Overrides EntityRouteProviderInterface:: |
|
EntityPermissionsRouteProvider:: |
public | function | Constructs a new EntityPermissionsRouteProvider. | |
EntityPermissionsRouteProviderWithCheck:: |
protected | function |
Gets the entity permissions route. Overrides EntityPermissionsRouteProvider:: |