Merge "Adds an option to include names in role assignment lists"
This commit is contained in:
@@ -189,6 +189,18 @@ class RoleAssignmentsTests(utils.ClientTestCase, utils.CrudTests):
|
|||||||
kwargs = {'effective': 'True'}
|
kwargs = {'effective': 'True'}
|
||||||
self.assertQueryStringContains(**kwargs)
|
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):
|
def test_role_assignments_list(self):
|
||||||
ref_list = self.TEST_ALL_RESPONSE_LIST
|
ref_list = self.TEST_ALL_RESPONSE_LIST
|
||||||
self.stub_entity('GET',
|
self.stub_entity('GET',
|
||||||
|
@@ -48,7 +48,7 @@ class RoleAssignmentManager(base.CrudManager):
|
|||||||
|
|
||||||
def list(self, user=None, group=None, project=None, domain=None, role=None,
|
def list(self, user=None, group=None, project=None, domain=None, role=None,
|
||||||
effective=False, os_inherit_extension_inherited_to=None,
|
effective=False, os_inherit_extension_inherited_to=None,
|
||||||
include_subtree=False):
|
include_subtree=False, include_names=False):
|
||||||
"""Lists role assignments.
|
"""Lists role assignments.
|
||||||
|
|
||||||
If no arguments are provided, all role assignments in the
|
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
|
return inherited role assignments for either 'projects' or
|
||||||
'domains'. (optional)
|
'domains'. (optional)
|
||||||
:param boolean include_subtree: Include subtree (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)
|
self._check_not_user_and_group(user, group)
|
||||||
@@ -89,6 +91,8 @@ class RoleAssignmentManager(base.CrudManager):
|
|||||||
query_params['role.id'] = base.getid(role)
|
query_params['role.id'] = base.getid(role)
|
||||||
if effective:
|
if effective:
|
||||||
query_params['effective'] = effective
|
query_params['effective'] = effective
|
||||||
|
if include_names:
|
||||||
|
query_params['include_names'] = include_names
|
||||||
if os_inherit_extension_inherited_to:
|
if os_inherit_extension_inherited_to:
|
||||||
query_params['scope.OS-INHERIT:inherited_to'] = (
|
query_params['scope.OS-INHERIT:inherited_to'] = (
|
||||||
os_inherit_extension_inherited_to)
|
os_inherit_extension_inherited_to)
|
||||||
|
@@ -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)
|
Reference in New Issue
Block a user