Merge "Adds an option to include names in role assignment lists"

This commit is contained in:
Jenkins
2016-01-23 17:00:08 +00:00
committed by Gerrit Code Review
3 changed files with 23 additions and 1 deletions

View File

@@ -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',

View File

@@ -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)

View File

@@ -0,0 +1,6 @@
---
features:
- >
[`bug 1479569 <https://bugs.launchpad.net/python-keystoneclient/+bug/1479569>`_]
With the ``include_names`` parameter set to True the names of the role assignments
are returned with the entities IDs. (GET /role_assignments?include_names=True)