diff --git a/core/lib/Drupal/Core/Access/AccessInterface.php b/core/lib/Drupal/Core/Access/AccessInterface.php index 2bce73e..4e8b885 100644 --- a/core/lib/Drupal/Core/Access/AccessInterface.php +++ b/core/lib/Drupal/Core/Access/AccessInterface.php @@ -44,18 +44,18 @@ /** * Checks for access to a route. * - * @param \Drupal\Core\Session\AccountInterface $account - * The currently logged in account. * @param \Symfony\Component\Routing\Route $route * The route to check against. * @param \Symfony\Component\HttpFoundation\Request $request * The request object. + * @param \Drupal\Core\Session\AccountInterface $account + * (optional) The currently logged in account. * * @return mixed * TRUE if access is allowed. * FALSE if not. * NULL if no opinion. */ - public function access(AccountInterface $account, Route $route, Request $request); + public function access(Route $route, Request $request, AccountInterface $account = NULL); } diff --git a/core/lib/Drupal/Core/Access/AccessManager.php b/core/lib/Drupal/Core/Access/AccessManager.php index 491b39b..c81b534 100644 --- a/core/lib/Drupal/Core/Access/AccessManager.php +++ b/core/lib/Drupal/Core/Access/AccessManager.php @@ -157,7 +157,7 @@ protected function checkAll(array $checks, Route $route, Request $request) { } $account = $request->attributes->get('account'); - $service_access = $this->checks[$service_id]->access($account, $route, $request); + $service_access = $this->checks[$service_id]->access($route, $request, $account); if ($service_access === AccessInterface::ALLOW) { $access = TRUE; } @@ -194,7 +194,7 @@ protected function checkAny(array $checks, $route, $request) { } $account = $request->attributes->get('account'); - $service_access = $this->checks[$service_id]->access($account, $route, $request); + $service_access = $this->checks[$service_id]->access($route, $request, $account); if ($service_access === AccessInterface::ALLOW) { $access = TRUE; } diff --git a/core/lib/Drupal/Core/Access/DefaultAccessCheck.php b/core/lib/Drupal/Core/Access/DefaultAccessCheck.php index d949606..21a6c11 100644 --- a/core/lib/Drupal/Core/Access/DefaultAccessCheck.php +++ b/core/lib/Drupal/Core/Access/DefaultAccessCheck.php @@ -26,7 +26,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($route->getRequirement('_access') === 'TRUE') { return static::ALLOW; } diff --git a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php index fcf558f..1fb4637 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php @@ -38,7 +38,7 @@ public function appliesTo() { * @endcode * Available operations are 'view', 'update', 'create', and 'delete'. */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { // Split the entity type and the operation. $requirement = $route->getRequirement('_entity_access'); list($entity_type, $operation) = explode('.', $requirement); diff --git a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php index 709a7aa..f7156f0 100644 --- a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php @@ -51,7 +51,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { list($entity_type, $bundle) = explode(':', $route->getRequirement($this->requirementsKey) . ':'); return $this->entityManager->getAccessController($entity_type)->createAccess($bundle, $account); } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php index a149ce1..4b02b5d 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php @@ -45,7 +45,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { return $account->hasPermission('access news feeds') && (bool) $this->database->queryRange('SELECT 1 FROM {aggregator_category}', 0, 1)->fetchField(); } diff --git a/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php b/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php index 946367d..b43dcc4 100644 --- a/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php +++ b/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $theme = $request->attributes->get('theme'); return $account->hasPermission('administer blocks') && drupal_theme_access($theme); } diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php index 8d469ff..f91671e 100644 --- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php +++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php @@ -30,7 +30,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { // @todo Request argument validation and object loading should happen // elsewhere in the request processing pipeline: // http://drupal.org/node/1798214. diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php index 9d00d0c..6db45cf 100644 --- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php +++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php @@ -30,7 +30,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { // @todo Request argument validation and object loading should happen // elsewhere in the request processing pipeline: // http://drupal.org/node/1798214. diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php index 965bc5d..75f5f81 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($entity_type = $request->attributes->get('entity_type')) { $bundle = $request->attributes->get('bundle'); $form_mode = $request->attributes->get('mode'); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php index 3235eaf..fd620be 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($entity_type = $request->attributes->get('entity_type')) { $bundle = $request->attributes->get('bundle'); $view_mode = $request->attributes->get('mode'); diff --git a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php index c56c3a1..5c674fc 100644 --- a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php +++ b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($format = $request->attributes->get('filter_format')) { // Handle special cases up front. All users have access to the fallback // format. diff --git a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php index f299370..67befb0 100644 --- a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php +++ b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * Implements \Drupal\Core\Access\AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($format = $request->attributes->get('filter_format')) { return $account->hasPermission('administer filters') && ($format->format != filter_fallback_format()); } diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php index 6ae396d..a274cb4 100644 --- a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php +++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($account->hasPermission('administer menu') && $menu_link = $request->attributes->get('menu_link')) { // Links defined via hook_menu may not be deleted. Updated items are an // exception, as they can be broken. diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php index 78cc08d..cfdff92 100644 --- a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php +++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($account->hasPermission('administer menu') && $menu = $request->attributes->get('menu')) { // System-defined menus may not be deleted. $system_menus = menu_list_system_menus(); diff --git a/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php b/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php index 8152e8a..779d71a 100644 --- a/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php +++ b/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php @@ -72,7 +72,7 @@ public function applies(Route $route) { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $revision = $this->nodeStorage->loadRevision($request->attributes->get('node_revision')); return $this->checkAccess($revision, $account, $route->getRequirement('_access_node_revision')) ? static::ALLOW : static::DENY; } diff --git a/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php b/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php index 2c35bb8..828d489 100644 --- a/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php +++ b/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if (!user_access('access overlay', $account)) { return static::DENY; } diff --git a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php index e4ee40e..460de6c 100644 --- a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php +++ b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php @@ -43,7 +43,7 @@ public function applies(Route $route) { /** * Implements AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $method = $request->getMethod(); $cookie = $request->cookies->get(session_name(), FALSE); // This check only applies if diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php index 2f8add9..ab3931e 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $menu_link = $request->attributes->get('menu_link'); $set_name = str_replace('shortcut-', '', $menu_link['menu_name']); if ($shortcut_set = shortcut_set_load($set_name)) { diff --git a/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php b/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php index 685377c..d9d7089 100644 --- a/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php +++ b/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * Implements AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $key = $request->attributes->get('key'); if ($key != \Drupal::state()->get('system.cron_key')) { watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE); diff --git a/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php b/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php index 22a9822..7d6aef7 100644 --- a/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php +++ b/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php @@ -45,7 +45,7 @@ public function applies(Route $route) { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($request->attributes->get('plugin_id')) { // Checks access for a given plugin using the plugin's access() method. $plugin_ui = $this->pluginUiManager->createInstance($request->attributes->get('plugin_id'), array()); diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php b/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php index f3f8efc..a3e1200 100644 --- a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php +++ b/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { if ($route->getRequirement('_test_access') === 'TRUE') { return static::ALLOW; } diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php b/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php index 1a976a6..14245f6 100644 --- a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php +++ b/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { /** * Implements AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { // No opinion, so other access checks should decide if access should be // allowed or not. return NULL; diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php b/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php index a5139c5..9931175 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $hash = $request->get('hash'); if ($account->hasPermission('access toolbar') && ($hash == _toolbar_get_subtree_hash())) { return TRUE; diff --git a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php index 04295ee..da59f07 100644 --- a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php +++ b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { return $account->isAuthenticated(); } diff --git a/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php index e887b64..d75b5a6 100644 --- a/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php +++ b/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * Implements AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $permission = $route->getRequirement('_permission'); // If the access check fails, return NULL to give other checks a chance. return $account->hasPermission($permission) ? static::ALLOW : static::DENY; diff --git a/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php index 342cbbb..7760eff 100644 --- a/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php +++ b/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php @@ -27,7 +27,7 @@ public function appliesTo() { /** * Implements AccessCheckInterface::access(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { return user_is_anonymous() && (config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY); } } diff --git a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php index cd5ebf3..20b16f7 100644 --- a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php +++ b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php @@ -31,7 +31,7 @@ public function appliesTo() { /** * {@inheritdoc} */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { // Requirements just allow strings, so this might be a comma separated list. $rid_string = $route->getRequirement('_role'); diff --git a/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php b/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php index a709e2e..44c42f7 100644 --- a/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php +++ b/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php @@ -29,7 +29,7 @@ public function appliesTo() { /** * Implements AccessCheckInterface::applies(). */ - public function access(AccountInterface $account, Route $route, Request $request) { + public function access(Route $route, Request $request, AccountInterface $account = NULL) { $access = $account->hasPermission('access all views'); return $access ?: NULL;