diff --git a/src/Drupal/Commands/core/RoleCommands.php b/src/Drupal/Commands/core/RoleCommands.php index c0894a6fe7..9ea5620390 100644 --- a/src/Drupal/Commands/core/RoleCommands.php +++ b/src/Drupal/Commands/core/RoleCommands.php @@ -100,13 +100,13 @@ public function roleRemovePerm($machine_name, $permissions): void /** * Display a list of all roles defined on the system. * - * If a role name is provided as an argument, then all of the permissions of - * that role will be listed. If a permission name is provided as an option, - * then all of the roles that have been granted that permission will be listed. - * * @command role:list + * @usage drush role:list authenticated + * Display permissions for the 'authenticated' role. * @usage drush role:list --filter='administer nodes' - * Display a list of roles that have the administer nodes permission assigned. + * Display a list of roles that have the 'administer nodes' permission assigned. + * @usage drush role:list --filter='rid=anonymous' + * Display only the 'anonymous' role. * @aliases rls,role-list * @field-labels * rid: ID @@ -118,11 +118,13 @@ public function roleRemovePerm($machine_name, $permissions): void public function roleList($options = ['format' => 'yaml']): RowsOfFields { $rows = []; + $roles = Role::loadMultiple(); foreach ($roles as $role) { $rows[$role->id()] = [ - 'label' => $role->label(), - 'perms' => $role->getPermissions(), + 'rid' => $role->id(), + 'label' => $role->label(), + 'perms' => $role->getPermissions(), ]; } $result = new RowsOfFields($rows);