Merge "Add include_subtree to role_list_assignments call"

This commit is contained in:
Jenkins
2015-12-16 01:55:41 +00:00
committed by Gerrit Code Review
2 changed files with 21 additions and 1 deletions

View File

@@ -121,6 +121,22 @@ class RoleAssignmentsTests(utils.TestCase, utils.CrudTests):
kwargs = {'scope.project.id': self.TEST_TENANT_ID}
self.assertQueryStringContains(**kwargs)
def test_project_assignments_list_include_subtree(self):
ref_list = self.TEST_GROUP_PROJECT_LIST + self.TEST_USER_PROJECT_LIST
self.stub_entity('GET',
[self.collection_key,
'?scope.project.id=%s&include_subtree=True' %
self.TEST_TENANT_ID],
entity=ref_list)
returned_list = self.manager.list(project=self.TEST_TENANT_ID,
include_subtree=True)
self._assert_returned_list(ref_list, returned_list)
kwargs = {'scope.project.id': self.TEST_TENANT_ID,
'include_subtree': 'True'}
self.assertQueryStringContains(**kwargs)
def test_domain_assignments_list(self):
ref_list = self.TEST_USER_DOMAIN_LIST
self.stub_entity('GET',

View File

@@ -47,7 +47,8 @@ class RoleAssignmentManager(base.CrudManager):
raise exceptions.ValidationError(msg)
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):
"""Lists role assignments.
If no arguments are provided, all role assignments in the
@@ -69,6 +70,7 @@ class RoleAssignmentManager(base.CrudManager):
:param string os_inherit_extension_inherited_to:
return inherited role assignments for either 'projects' or
'domains'. (optional)
:param boolean include_subtree: Include subtree (optional)
"""
self._check_not_user_and_group(user, group)
@@ -90,6 +92,8 @@ class RoleAssignmentManager(base.CrudManager):
if os_inherit_extension_inherited_to:
query_params['scope.OS-INHERIT:inherited_to'] = (
os_inherit_extension_inherited_to)
if include_subtree:
query_params['include_subtree'] = include_subtree
return super(RoleAssignmentManager, self).list(**query_params)