public function Permissions::query in Zircon Profile 8
Same name in this branch
- 8 core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions::query()
- 8 core/modules/user/src/Plugin/views/field/Permissions.php \Drupal\user\Plugin\views\field\Permissions::query()
Same name and namespace in other branches
- 8.0 core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions::query()
Replace the configured permission with a filter by all roles that have this permission.
Overrides InOperator::query
File
- core/
modules/ user/ src/ Plugin/ views/ filter/ Permissions.php, line 93 - Contains \Drupal\user\Plugin\views\filter\Permissions.
Class
- Permissions
- Filter handler for user roles.
Namespace
Drupal\user\Plugin\views\filterCode
public function query() {
// @todo user_role_names() should maybe support multiple permissions.
$rids = array();
// Get all roles, that have the configured permissions.
foreach ($this->value as $permission) {
$roles = user_role_names(FALSE, $permission);
$rids += array_keys($roles);
}
$rids = array_unique($rids);
$this->value = $rids;
// $this->value contains the role IDs that have the configured permission.
parent::query();
}