Skip to content
Snippets Groups Projects
Commit d155ba9b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2375107 by olli: Unable to allow multiple roles access views page

parent 1edfae73
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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']));
}
}
......
......@@ -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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment