You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importrequests, jsonimportostoken=os.environ.get('AT')
headers= {"Authorization": f"Bearer {token}"}
iam_list_url='https://lhcb-auth.web.cern.ch/iam/account/search'results= []
startIndex=1totalResults=1000# total number of usersitemsPerPage=10while(startIndex<totalResults):
resp=requests.get(iam_list_url, headers=headers, params= {'startIndex':startIndex})
resp.raise_for_status()
data=resp.json()
# These 2 should never change, but just to be sure...totalResults=data['totalResults']
itemsPerPage=data['itemsPerPage']
startIndex+=itemsPerPageresults.extend(data['Resources'])
withopen('accounts.json', 'w+') asfp:
fp.write(json.dumps(results))
Edit: I add an extra usecase to this task
The VOMS interface provided by IAM does not actually expose the voms-admin API, which means we need to query the IAM API to list the users.
TODO:
/DiracX/<vo>/UserSubjects
([9.0] Populate diracx user subs from IAM #7711)In the VOMS2CSAgent, update the
/DiracX/<vo><UserSubjects>
section directly from IAM (https://indigo-iam.github.io/v/v1.8.3/docs/reference/api/account-api/#get-iamaccountsearch)Originally posted by @chaen in DIRACGrid/diracx#191 (comment)
The text was updated successfully, but these errors were encountered: