class DefaultAccessCheck in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck
- 9 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck
Allows access to routes to be controlled by an '_access' boolean parameter.
Hierarchy
- class \Drupal\Core\Access\DefaultAccessCheck implements AccessInterface
Expanded class hierarchy of DefaultAccessCheck
2 files declare their use of DefaultAccessCheck
- AccessManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - Contains \Drupal\Tests\Core\Access\AccessManagerTest.
- DefaultAccessCheckTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ DefaultAccessCheckTest.php
1 string reference to 'DefaultAccessCheck'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses DefaultAccessCheck
File
- core/
lib/ Drupal/ Core/ Access/ DefaultAccessCheck.php, line 11
Namespace
Drupal\Core\AccessView source
class DefaultAccessCheck implements RoutingAccessInterface {
/**
* Checks access to the route based on the _access parameter.
*
* @param \Symfony\Component\Routing\Route $route
* The route to check against.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access(Route $route) {
if ($route
->getRequirement('_access') === 'TRUE') {
return AccessResult::allowed();
}
elseif ($route
->getRequirement('_access') === 'FALSE') {
return AccessResult::forbidden();
}
else {
return AccessResult::neutral();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultAccessCheck:: |
public | function | Checks access to the route based on the _access parameter. |