interface PermissionCheckerInterface
Same name in other branches
- 10 core/lib/Drupal/Core/Session/PermissionCheckerInterface.php \Drupal\Core\Session\PermissionCheckerInterface
Defines a permission checker interface.
This service checks if a role has a permission. It can be swapped out or decorated to allow for more complex logic. If you do so, ensure that you provide ample automated tests so your site remains secure.
Hierarchy
- interface \Drupal\Core\Session\PermissionCheckerInterface
Expanded class hierarchy of PermissionCheckerInterface
All classes that implement PermissionCheckerInterface
Related topics
File
-
core/
lib/ Drupal/ Core/ Session/ PermissionCheckerInterface.php, line 14
Namespace
Drupal\Core\SessionView source
interface PermissionCheckerInterface {
/**
* Checks whether an account has a permission.
*
* @param string $permission
* The name of the permission to check for.
* @param \Drupal\Core\Session\AccountInterface $account
* The user account for which to check the permissions.
*
* @return bool
* Whether the account has the permission.
*/
public function hasPermission(string $permission, AccountInterface $account) : bool;
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
PermissionCheckerInterface::hasPermission | public | function | Checks whether an account has a permission. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.