summaryrefslogtreecommitdiffstats
path: root/core/modules/user/src/Plugin/views/filter/Permissions.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/user/src/Plugin/views/filter/Permissions.php')
-rw-r--r--core/modules/user/src/Plugin/views/filter/Permissions.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/modules/user/src/Plugin/views/filter/Permissions.php b/core/modules/user/src/Plugin/views/filter/Permissions.php
index 6cbb703..84f19bf 100644
--- a/core/modules/user/src/Plugin/views/filter/Permissions.php
+++ b/core/modules/user/src/Plugin/views/filter/Permissions.php
@@ -94,11 +94,14 @@ class Permissions extends ManyToOne {
public function query() {
// @todo user_role_names() should maybe support multiple permissions.
$rids = array();
- // Get all roles, that have the configured permissions.
+ // Get all role IDs that have the configured permissions.
foreach ($this->value as $permission) {
$roles = user_role_names(FALSE, $permission);
- $rids += array_keys($roles);
+ // user_role_names() returns an array with the role IDs as keys, so take
+ // the array keys and merge them with previously found role IDs.
+ $rids = array_merge($rids, array_keys($roles));
}
+ // Remove any duplicate role IDs.
$rids = array_unique($rids);
$this->value = $rids;