Skip to content

Commit

Permalink
GrouperAPI: Adjustments to get_grouper_details #42
Browse files Browse the repository at this point in the history
Takes in full path and response provide GroupResults
  • Loading branch information
astrochun committed Sep 17, 2020
1 parent 4fad767 commit ab0b04f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions requiam/grouper_admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from os.path import dirname, join
import requests
import pandas as pd

Expand Down Expand Up @@ -50,26 +51,20 @@ 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)
def get_group_details(self, group):
"""Retrieve group details. The full path is needed"""

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

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

return rsp.json()
return rsp.json()['WsFindGroupsResults']['groupResults']

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

0 comments on commit ab0b04f

Please sign in to comment.