diff --git a/keystoneclient/tests/unit/v3/test_role_assignments.py b/keystoneclient/tests/unit/v3/test_role_assignments.py index e77bdccce..21fc2c322 100644 --- a/keystoneclient/tests/unit/v3/test_role_assignments.py +++ b/keystoneclient/tests/unit/v3/test_role_assignments.py @@ -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', diff --git a/keystoneclient/v3/role_assignments.py b/keystoneclient/v3/role_assignments.py index d71f9eb11..fb9b5c71f 100644 --- a/keystoneclient/v3/role_assignments.py +++ b/keystoneclient/v3/role_assignments.py @@ -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)