Skip to content

Commit

Permalink
GrouperAPI: Add get_group_details #42
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Sep 17, 2020
1 parent 0d925fd commit 4fad767
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions requiam/grouper_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ def get_group_list(self, group_type):

return rsp.json()

def get_group_details(self, group, group_type):
"""Retrieve group details"""

if group_type not in ['portal', 'quota', 'test', '']:
raise ValueError("Incorrect [group_type] input")

grouper_name = figshare_group(group, group_type,
production=self.grouper_production)

params = dict()
params['WsRestFindGroupsRequest'] = {
'wsQueryFilter':
{'queryFilterType': 'FIND_BY_GROUP_NAME_APPROXIMATE',
'groupName': grouper_name}
}

rsp = requests.post(self.endpoint, json=params, headers=self.headers,
auth=(self.grouper_user, self.grouper_password))

return rsp.json()

def check_group_exists(self, group, group_type):
"""Check whether a Grouper group exists within a Grouper stem"""

Expand Down Expand Up @@ -102,3 +123,4 @@ def add_group(self, group, group_type, description):
raise errmsg
except requests.exceptions.HTTPError:
raise requests.exceptions.HTTPError

0 comments on commit 4fad767

Please sign in to comment.