diff options
| author | Tom Cocozzello <tjcocozz@us.ibm.com> | 2015-12-09 10:38:14 -0600 |
|---|---|---|
| committer | Steve Martinelli <stevemar@ca.ibm.com> | 2016-01-23 15:06:19 +0000 |
| commit | 32ec1722c6fe5b5074070718705ba31ce79b0422 (patch) | |
| tree | e33357b45d3035a04dc9a6154bdafabad4f20d4a /keystoneclient | |
| parent | 0a0419d2b8a5580fbdce9a673b132af5fa0c4d57 (diff) | |
| download | python-keystoneclient-32ec1722c6fe5b5074070718705ba31ce79b0422.tar.gz | |
Adds an option to include names in role assignment lists
Allow the client to take advantage of the include_names with
list role assignments.
Change-Id: I4aa77c08660a0cbd021502155938a46121ca76ef
Depends-On: I0a1cc986b8a35aeafe567e5e7fee6eeb848ae113
Closes-Bug: #1479569
Implements: blueprint list-assignment-with-names
Diffstat (limited to 'keystoneclient')
| -rw-r--r-- | keystoneclient/tests/unit/v3/test_role_assignments.py | 12 | ||||
| -rw-r--r-- | keystoneclient/v3/role_assignments.py | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/keystoneclient/tests/unit/v3/test_role_assignments.py b/keystoneclient/tests/unit/v3/test_role_assignments.py index b955dfa..b24799c 100644 --- a/keystoneclient/tests/unit/v3/test_role_assignments.py +++ b/keystoneclient/tests/unit/v3/test_role_assignments.py @@ -189,6 +189,18 @@ class RoleAssignmentsTests(utils.ClientTestCase, utils.CrudTests): kwargs = {'effective': 'True'} self.assertQueryStringContains(**kwargs) + def test_include_names_assignments_list(self): + ref_list = self.TEST_ALL_RESPONSE_LIST + self.stub_entity('GET', + [self.collection_key, + '?include_names'], + entity=ref_list) + + returned_list = self.manager.list(include_names=True) + self._assert_returned_list(ref_list, returned_list) + kwargs = {'include_names': 'True'} + self.assertQueryStringContains(**kwargs) + def test_role_assignments_list(self): ref_list = self.TEST_ALL_RESPONSE_LIST self.stub_entity('GET', diff --git a/keystoneclient/v3/role_assignments.py b/keystoneclient/v3/role_assignments.py index fb9b5c7..1e85e83 100644 --- a/keystoneclient/v3/role_assignments.py +++ b/keystoneclient/v3/role_assignments.py @@ -48,7 +48,7 @@ class RoleAssignmentManager(base.CrudManager): def list(self, user=None, group=None, project=None, domain=None, role=None, effective=False, os_inherit_extension_inherited_to=None, - include_subtree=False): + include_subtree=False, include_names=False): """Lists role assignments. If no arguments are provided, all role assignments in the @@ -71,6 +71,8 @@ class RoleAssignmentManager(base.CrudManager): return inherited role assignments for either 'projects' or 'domains'. (optional) :param boolean include_subtree: Include subtree (optional) + :param boolean include_names: Display names instead + of IDs. (optional) """ self._check_not_user_and_group(user, group) @@ -89,6 +91,8 @@ class RoleAssignmentManager(base.CrudManager): query_params['role.id'] = base.getid(role) if effective: query_params['effective'] = effective + if include_names: + query_params['include_names'] = include_names if os_inherit_extension_inherited_to: query_params['scope.OS-INHERIT:inherited_to'] = ( os_inherit_extension_inherited_to) |
