Is there a way to change users from level 2 to level 1 in bulk (rather than one at a time)?

926
3
01-30-2017 06:51 AM
Highlighted
New Contributor II

Using ArcGIS Enterprise 10.5, is it possible to write a script to change named users from Level 2 users to Level 1 users?  I looked at the ArcGIS Python API and while it appears you can do a number of things, including changing the role, I did not see any mention of changing the level in the documentation.

Thanks!

Mike Sweeney

Reply
0 Kudos
3 Replies
Highlighted
Esri Frequent Contributor

If you can do it through the UI, you can do it through Python.  Taking a look at the network traffic, it looks like it updates the user level by using the following URL and parameters:

https://<portal_host>/<context>/sharing/rest/portals/self/updateUserLevel and passes the following parameters:

{
"user": "<user_name>",
"level": "<new_level>",
"f": "json",
"token": "<token>"
}

Then, it updates the user to be an appropriate role for the new level:

https://<portal_host>/<context>/sharing/rest/portals/self/updateUserRole 

{
"user": "<user_name>",
"role": "<new_role>",
"f": "json",
"token": "<token>"
}

I'm not too sure if it's been included in the documentation or the Python API itself, though.

Highlighted
New Contributor II

Is this only for Portal? Will it work for AGOL? 

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

I believe the URLs above will only work for Portal, but the same concept applies; perform your operation in ArcGIS Online with Fiddler or the Dev Tools open to capture the traffic, and then recreate the request using Python.