Hi,
I am doing reporting on our user types on ArcGIS Online. Recently AGOL changed user types from level 1 & level 2 to Creator, Editor, Viewer, etc as per screenshot below.
I can't find the right object (or property of an object) in ArcGIS API for Python to get these user types programically
.
All I get is our custom roles, levels (which are 1, 2 and 11 and nothing else) and user types (org_admin, org_publisher and org_users) which don't match the new user types. Has anyone worked out how to do it?
My current code is something like that:
for user in gis.users.search(max_users=500):
try:
name = user.username
role = user.role
ulevel = user.level
firstname = user.firstName
lastname = user.lastName
last_login = user.lastLogin
if hasattr(user, 'roleId'):
for role in roles:
if(user.roleId == role.role_id):
role_name = role.name
else:
role_name = "undefined"
diff_name = gis.users.get(name)
Solved! Go to Solution.
Hi Lidia,
The property you're looking for is userType. Valid values correspond to the userLicenseTypeId values described in REST API documentation:
creatorUT | editorUT | GISProfessionalAdvUT | GISProfessionalBasicUT | GISProfessionalStdUT | viewerUT | fieldWorkerUT
https://developers.arcgis.com/rest/enterprise-administration/portal/create-user.htm
Hi Lidia,
The property you're looking for is userType. Valid values correspond to the userLicenseTypeId values described in REST API documentation:
creatorUT | editorUT | GISProfessionalAdvUT | GISProfessionalBasicUT | GISProfessionalStdUT | viewerUT | fieldWorkerUT
https://developers.arcgis.com/rest/enterprise-administration/portal/create-user.htm
Great! It's exactly what I was after! Thanks.
When I run the code using user.userType, the only value returned from ArcGIS Enterprise v10.9.1 is 'arcgisonly'. Using 'user.userLicenseTypeId' got me what I expected: the four types associated with our User Types in our Enterprise portal: Creator, Editor, Mobile Worker, and Viewer.
Would be great if userType and userLicenseTypeId were documented in the python API docs: https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user
The best option seems to set the role AND the usertype AND the level when you create a new user. Otherwise the new member default get in your way and the user may either not be created or created with the wrong settings. This is not really clear in de documentation.