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

1197
3
01-30-2017 06:51 AM
MikeSweeney
Esri Contributor

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

0 Kudos
3 Replies
JonathanQuinn
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.

BenVanderford1
New Contributor II

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

0 Kudos
JonathanQuinn
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.