Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/shortcut/src/ShortcutSetAccessControlHandler.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
18 * {@inheritdoc} | 18 * {@inheritdoc} |
19 */ | 19 */ |
20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { | 20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { |
21 switch ($operation) { | 21 switch ($operation) { |
22 case 'view': | 22 case 'view': |
23 return AccessResult::allowedIf($account->hasPermission('access shortcuts'))->cachePerPermissions(); | 23 return AccessResult::allowedIfHasPermission($account, 'access shortcuts'); |
24 case 'update': | 24 case 'update': |
25 if ($account->hasPermission('administer shortcuts')) { | 25 if ($account->hasPermission('administer shortcuts')) { |
26 return AccessResult::allowed()->cachePerPermissions(); | 26 return AccessResult::allowed()->cachePerPermissions(); |
27 } | 27 } |
28 if (!$account->hasPermission('access shortcuts')) { | 28 if (!$account->hasPermission('access shortcuts')) { |