From d155ba9b859e439c93256ddc770da773c0c0ad5d Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 18 Nov 2014 22:28:19 +0000
Subject: [PATCH] Issue #2375107 by olli: Unable to allow multiple roles access
 views page

---
 .../user/src/Plugin/views/access/Role.php      |  2 +-
 .../user/src/Tests/Views/AccessRoleTest.php    | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/core/modules/user/src/Plugin/views/access/Role.php b/core/modules/user/src/Plugin/views/access/Role.php
index 644252576d13..a32cd6502862 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 96ef4f58f1fe..0f06ae2c02c1 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);
   }
 
 }
-- 
GitLab