Skip to content

Commit

Permalink
Update crowd.py
Browse files Browse the repository at this point in the history
- Add a parameter `max_results` has prevented insufficient results from being returned, the server default is `1000`
  • Loading branch information
ChowRex authored Dec 8, 2023
1 parent f3acc56 commit 5aa4190
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions atlassian/crowd.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,18 @@ def user_groups(self, username, kind='direct'):
response = self.get(path, params={'username': username})
return search('groups[*].name', response)

def group_members(self, group, kind='direct'):
def group_members(self, group, kind='direct', max_results=99999):
"""
Get group's all direct members
:param group: str - group name
:param kind: str - group type
:param max_results: int - maximum number of results
:return: The specify group's direct members info
"""
path = self._crowd_api_url("usermanagement",
"group/user/{kind}".format(kind=kind))
response = self.get(path, params={'groupname': group})
params = {'groupname': group, 'max-results': max_results}
response = self.get(path, params=params)
return search('users[*].name', response)

def is_user_in_group(self, username, group, kind='direct'):
Expand Down

0 comments on commit 5aa4190

Please sign in to comment.