diff --git a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php index 3541168..5aa2800 100644 --- a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php +++ b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php @@ -12,7 +12,7 @@ use Symfony\Component\Routing\Route; /** - * Determines access to routes based on roles defined via hook_permission(). + * Determines access to routes based on roles. */ class RoleAccessCheck implements AccessCheckInterface { @@ -39,6 +39,7 @@ public function access(Route $route, Request $request) { if (empty($diff)) { return TRUE; } + // If there is no allowed role, return NULL to give other checks a chance. else { return NULL; } diff --git a/core/tests/Drupal/Tests/Core/Route/RouterRoleTest.php b/core/tests/Drupal/Tests/Core/Route/RouterRoleTest.php index 9f9f73b..b593a1b 100644 --- a/core/tests/Drupal/Tests/Core/Route/RouterRoleTest.php +++ b/core/tests/Drupal/Tests/Core/Route/RouterRoleTest.php @@ -17,7 +17,8 @@ use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -// Needed because the Entity class calls it. +// Needed because the Entity class uses this constant. +// @todo Remove once http://drupal.org/node/1620010 is in. if (!defined('LANGUAGE_NOT_SPECIFIED')) { define('LANGUAGE_NOT_SPECIFIED', 'und'); } @@ -37,7 +38,7 @@ class RouterRoleTest extends UnitTestCase { public static function getInfo() { return array( 'name' => 'Router Role tests', - 'description' => 'Function Tests for the routing role system.', + 'description' => 'Test for the role based access checker in the routing system.', 'group' => 'Routing', ); } @@ -80,8 +81,10 @@ protected function getTestRouteCollection() { /** * Provides data for the role access test. + * + * @see \Drupal\Tests\Core\Route\RouterRoleTest::testRoleAccess */ - public function testRoleAccessProvider() { + public function roleAccessProvider() { // Setup two different roles used in the test. $rid_1 = 'role_test_1'; $rid_2 = 'role_test_2'; @@ -143,8 +146,9 @@ protected function accountsToDeny($grant_users) { * A list of accounts which should have access to the given path. * * @see \Drupal\Tests\Core\Route\RouterRoleTest::getTestRouteCollection + * @see \Drupal\Tests\Core\Route\RouterRoleTest::roleAccessProvider * - * @dataProvider testRoleAccessProvider + * @dataProvider roleAccessProvider */ public function testRoleAccess($path, $grant_accounts) { $role_access_check = new RoleAccessCheck();