class CustomAccessCheck in Entity connect 8.2
Custom access checking class for entityconnect.
Hierarchy
- class \Drupal\entityconnect\Access\CustomAccessCheck implements AccessCheckInterface
Expanded class hierarchy of CustomAccessCheck
1 string reference to 'CustomAccessCheck'
1 service uses CustomAccessCheck
File
- src/
Access/ CustomAccessCheck.php, line 13
Namespace
Drupal\entityconnect\AccessView source
class CustomAccessCheck implements AccessCheckInterface {
/**
* {@inheritdoc}
*/
public function applies(Route $route) {
return $route
->hasRequirement('_entityconnect_access_check');
}
/**
* A custom access check.
*
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
*
* @return \Drupal\Core\Access\AccessResult
* If the account has the permissions, isAllowed() will be TRUE,
* otherwise isNeutral() will be TRUE.
*/
public function access(AccountInterface $account) {
// Check permissions and combine that with any custom access checking
// needed. Pass forward parameters from the route and/or request as needed.
return AccessResultAllowed::allowedIfHasPermissions($account, [
'entityconnect add button',
'entityconnect edit button',
], 'OR');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CustomAccessCheck:: |
public | function | A custom access check. | |
CustomAccessCheck:: |
public | function |
Declares whether the access check applies to a specific route or not. Overrides AccessCheckInterface:: |