Add identity.group_users method
Add method to list users of a group. Change-Id: Ic2986b107c921752c9e174fe4b7209eec9bf7704
This commit is contained in:
parent
817c453948
commit
a426e6565a
@ -43,7 +43,7 @@ Group Operations
|
||||
:noindex:
|
||||
:members: create_group, update_group, delete_group, get_group, find_group,
|
||||
groups, add_user_to_group, remove_user_from_group,
|
||||
check_user_in_group
|
||||
check_user_in_group, group_users
|
||||
|
||||
Policy Operations
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
@ -44,6 +44,7 @@ from openstack.identity.v3 import system as _system
|
||||
from openstack.identity.v3 import trust as _trust
|
||||
from openstack.identity.v3 import user as _user
|
||||
from openstack import proxy
|
||||
from openstack import utils
|
||||
|
||||
|
||||
class Proxy(proxy.Proxy):
|
||||
@ -405,6 +406,21 @@ class Proxy(proxy.Proxy):
|
||||
group = self._get_resource(_group.Group, group)
|
||||
return group.check_user(self, user)
|
||||
|
||||
def group_users(self, group, **attrs):
|
||||
"""List users in a group
|
||||
|
||||
:param group: Either the ID of a group or a
|
||||
:class:`~openstack.identity.v3.group.Group` instance.
|
||||
:param attrs: Only password_expires_at can be filter for result.
|
||||
|
||||
:return: List of :class:`~openstack.identity.v3.user.User`
|
||||
"""
|
||||
group = self._get_resource(_group.Group, group)
|
||||
base_path = utils.urljoin(
|
||||
group.base_path, group.id, 'users')
|
||||
users = self._list(_user.User, base_path=base_path, **attrs)
|
||||
return users
|
||||
|
||||
def create_policy(self, **attrs):
|
||||
"""Create a new policy from attributes
|
||||
|
||||
|
@ -168,6 +168,12 @@ class TestIdentityProxyGroup(TestIdentityProxyBase):
|
||||
]
|
||||
)
|
||||
|
||||
def test_group_users(self):
|
||||
self.verify_list(
|
||||
self.proxy.group_users, user.User,
|
||||
method_kwargs={"group": 'group', "attrs": 1},
|
||||
expected_kwargs={"attrs": 1})
|
||||
|
||||
|
||||
class TestIdentityProxyPolicy(TestIdentityProxyBase):
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add possibility to list users in the group.
|
Loading…
Reference in New Issue
Block a user