diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index 32b3ee4..9aad750 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -79,4 +79,3 @@ shortcut.set_switch: _custom_access: 'Drupal\shortcut\Form\SwitchShortcutSet::checkAccess' options: _admin_route: TRUE - diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php index b3b3072..376e82a 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -235,11 +235,16 @@ public function submitForm(array &$form, array &$form_state) { /** * Checks access for the shortcut set switch form. * + * @param \Drupal\user\UserInterface $user + * (optional) The owner of the shortcut set. + * * @return mixed * AccessInterface::ALLOW, AccessInterface::DENY, or AccessInterface::KILL. */ - public function checkAccess() { + public function checkAccess(UserInterface $user = NULL) { $account = $this->currentUser(); + $this->user = $user; + if ($account->hasPermission('administer shortcuts')) { // Administrators can switch anyone's shortcut set. return AccessInterface::ALLOW;