class CustomAccessCheck in OAuth 1.0 8.2
Checks access for oauth.
Hierarchy
- class \Drupal\oauth\Access\CustomAccessCheck implements AccessInterface
Expanded class hierarchy of CustomAccessCheck
1 string reference to 'CustomAccessCheck'
1 service uses CustomAccessCheck
File
- src/
Access/ CustomAccessCheck.php, line 17 - Contains \Drupal\example\Access\CustomAccessCheck.
Namespace
Drupal\oauth\AccessView source
class CustomAccessCheck implements AccessInterface {
/**
* Check if the user can administer their own keys, or has the 'administer
* consumer' permission.
*
* @param \Drupal\Core\User\UserInterface
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
* @return bool
*/
public function access(UserInterface $user, AccountInterface $account) {
return AccessResult::allowedIfHasPermission($account, 'administer consumers')
->orIf(AccessResult::allowedIf($user
->id() == $account
->id())
->addCacheableDependency($account)
->andIf(AccessResult::allowedIfHasPermission($account, 'access own consumers')));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CustomAccessCheck:: |
public | function | Check if the user can administer their own keys, or has the 'administer consumer' permission. |