How to get information on which SAML group is used in a portal group?

157
3
Jump to solution
01-27-2022 01:51 AM
CarstenB_orsted
New Contributor II

 

I need to move groups from one enterprise portal to another. The groups are getting their members from SAML groups and I want to use the same SAML group on the target portal.

But I can't find any method in the API that returns which SAML group is used in the source group . I can get a list of users with group.get_members() or group.user_list() but not the SAML group.

I couldn't find anything in the REST API either.

The information is there, as you can edit it on the settings tab on the group.

Am I overlooking something obvious?

I'm using Enterprise 10.9.1 and ArcGIS API for Python 1.9.1

Update: I found two properties for groups,  provider and providerGroupName. If the group uses SAML , provider is set to 'enterprise', but providerGroupName is still None.

Also the isInvitationOnly property is False for groups using SAML

So at least now I can check whether SAML is used and give a warning that information should be updated manually. 

 

0 Kudos
1 Solution

Accepted Solutions
AzinSharaf
Occasional Contributor II

that is correct. providerGroupName returns None.

another way to get the providerGroupName using SAML is:

- get the group id using groupid properties

- build this url: group_url = f"https://portal_url/webadaptor/sharing/rest/community/groups/{group_id}"

- using urllib find the ProviderGroupName tag value from response. 

AzinSharaf_0-1643310425282.png

 

 

View solution in original post

3 Replies
AzinSharaf
Occasional Contributor II

that is correct. providerGroupName returns None.

another way to get the providerGroupName using SAML is:

- get the group id using groupid properties

- build this url: group_url = f"https://portal_url/webadaptor/sharing/rest/community/groups/{group_id}"

- using urllib find the ProviderGroupName tag value from response. 

AzinSharaf_0-1643310425282.png

 

 

CarstenB_orsted
New Contributor II

Hi Azin,

Thanks, I'll try it out as soon as possible. 

BTW: I just asked Esri support why the providerGroupName is None. I'll post updates here.

UPDATE: I couldn't wait trying it, even though it is late evening here. I get the information I need with the solution provided. Thanks again!

However, I think the information should be available through the ArcGIS API for Python!

Regards

Carsten

CarstenB_orsted
New Contributor II

Here's a couple of code snippets if anyone should need it.

Using the f=json parameter returns the response as json, making it very easy to parse.

First using the requests module

import requests

url =https://myserver.com/portal/sharing/rest/community/groups/{group_id}?f=pjson"

r = requests.get(url)
rjson = r.json()

provider = rjson["provider"]
providerGroupName = rjson["providerGroupName"]

print(provider)
print(providerGroupName)

And the the same thing, using urllib

from urllib.request import urlopen
import json

url = "https://myserver/portal/sharing/rest/community/groups/{group_id}?f=pjson"

r = urlopen(url)
rjson = json.loads(r.read())

provider = rjson["provider"]
providerGroupName = rjson["providerGroupName"]

print(provider)
print(providerGroupName)