diff --git a/core/modules/user/src/Plugin/views/access/Role.php b/core/modules/user/src/Plugin/views/access/Role.php index 644252576d130ed64b6470472a6140002b5b0f0c..a32cd65028625bcff93ad68f0154174f4332883b 100644 --- a/core/modules/user/src/Plugin/views/access/Role.php +++ b/core/modules/user/src/Plugin/views/access/Role.php @@ -43,7 +43,7 @@ public function access(AccountInterface $account) { */ public function alterRouteDefinition(Route $route) { if ($this->options['role']) { - $route->setRequirement('_role', (string) implode(',', $this->options['role'])); + $route->setRequirement('_role', (string) implode('+', $this->options['role'])); } } diff --git a/core/modules/user/src/Tests/Views/AccessRoleTest.php b/core/modules/user/src/Tests/Views/AccessRoleTest.php index 96ef4f58f1fe9dedcbae9f633331a8c42e2a6541..0f06ae2c02c1b4ce0aa4b4dbb8c19b00a9e38194 100644 --- a/core/modules/user/src/Tests/Views/AccessRoleTest.php +++ b/core/modules/user/src/Tests/Views/AccessRoleTest.php @@ -61,6 +61,24 @@ function testAccessRole() { $this->drupalLogin($this->normalUser); $this->drupalGet('test-role'); $this->assertResponse(200); + + // Test allowing multiple roles. + $view = Views::getView('test_access_role')->storage; + $display = &$view->getDisplay('default'); + $display['display_options']['access']['options']['role'] = array( + $this->normalRole => $this->normalRole, + 'anonymous' => 'anonymous', + ); + $view->save(); + $this->drupalLogin($this->webUser); + $this->drupalGet('test-role'); + $this->assertResponse(403); + $this->drupalLogout(); + $this->drupalGet('test-role'); + $this->assertResponse(200); + $this->drupalLogin($this->normalUser); + $this->drupalGet('test-role'); + $this->assertResponse(200); } }