Defines the access controller for the shortcut entity type.
Expanded class hierarchy of ShortcutAccessController
class ShortcutAccessController extends EntityAccessController {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
switch ($operation) {
case 'edit':
if (user_access('administer shortcuts', $account)) {
return TRUE;
}
if (user_access('customize shortcut links', $account)) {
return !isset($entity) || $entity == shortcut_current_displayed_set($account);
}
return FALSE;
break;
case 'delete':
if (!user_access('administer shortcuts', $account)) {
return FALSE;
}
return $entity
->id() != 'default';
break;
}
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityAccessController:: |
protected | property | Stores calculcated access check results. | |
EntityAccessController:: |
public | function |
Checks access to an operation on a given entity or entity translation. Overrides EntityAccessControllerInterface:: |
1 |
EntityAccessController:: |
protected | function | Tries to retrieve a previously cached access value from the static cache. | |
EntityAccessController:: |
public | function |
Clears all cached access checks. Overrides EntityAccessControllerInterface:: |
|
EntityAccessController:: |
protected | function | Statically caches whether the given user has access. | |
ShortcutAccessController:: |
protected | function |
Performs access checks. Overrides EntityAccessController:: |