When I try and create list of all our Portal and AGOL users, and expose roles and the default roles come out correctly but for custom roles that were created, they usually come out as unreadable text as show below,
O4FzYnPm7f7Ra30H
|
Is there a way to properly get the role names?
Thanks,
Chris P
To the best of my knowledge those are the proper role names. When a custom role is created in the background it creates that string of unreadable text to uniquely identify it. This way if your organization has a "Content Manager" role and my organization has a "Content Manager" role then python will be able to identify which role you want for your user instead of getting confused if our Content Manager permissions are different. Think of it as the Group ID string of text, but for roles.
Thanks Fay. I see from documentation that there is a "roleId" apart from "role" that can be exposed, so interesting that they don't have something like "roleLabel" or something. Anyway I guess i'll just look more to the online doc if there is a way otherwise I cannot its something I cannot add to my report that I am trying to automate.
Hello Fay, Chris,
Jamie Powell and I just found and submitted a bug in the Python API on this matter. We were working in ArcGIS Online, but had the same issue. The good news is that for now you can use the "unreadable" (what I like to call "ishkabible") text for the custom role and code will respect it.
Adena
Hello Fay, Chris,
The issue is that the user role name, and user role id are switched in the source code. Obtaining the role from the user will always return the id. If you attempt to search for a user by name using the ID text returned, you will not get any search results. As a work around I am now searching by roleId instead.
Thank you,
Jamie Powell
Hi
You can use
from arcgis.gis import GIS
source = GIS("Portal Web Adaptor URL", "Admin", "Password")
role_mgr = arcgis.gis.RoleManager(source)
roles = role_mgr.all()
for role in roles:
print("Role Name: {}".format(role.name))
print("Role Privileges: {}".format(role.privileges))