Select to view content in your preferred language

what is the userType in a User resource?

1822
3
10-23-2017 08:59 AM
TerryGiles
Frequent Contributor

I'm querying AGOL to get info on our users & their items.  When I get a user via a request to https://my_org.maps.arcgis.com/sharing/rest/community/users/<userID>/?f=pjson&token=<valid token> it includes a userType property in the response.  Looking @ the docs for a User I do not see what this represents.  Most users return the value of 'arcgisonly' but a couple have 'both' for this property.  Anyone know what the domain is for this property & what the values mean?

sample response:

{
    "username": "my_username",
    "fullName": "Terry Giles",
    "firstName": "Terry",
    "lastName": "Giles",
    "preferredView": null,
    "description": "Terry Giles, ent. account",
    "email": "my.email@work.gov",
    "userType": "arcgisonly",
    ...
}

Thanks, Terry

3 Replies
DeniseKing
Esri Regular Contributor

I found the information for userType here, GEO Jobe Knowledge Base 

RHmapping
Occasional Contributor

old thread but I have found that User.user_types() returns a dict of stuff the user has rights to in the portal, and that the "id" returns something that relates to the User Type you see in the Portal Org Members admin.

User.user_types()["id"]

The following code worked to list all users and basic info about them, in our Portal which is 10.8

copy + paste that into a CSV .. 

import datetime
import arcgis

def convertPortalDate(portalStamp):
    try :
        return datetime.datetime.fromtimestamp( portalStamp / 1000 )
    except :
        return portalStamp
    
def getShortDate(d) :
    return d.strftime('%d %b %Y')

portal = arcgis.gis.GIS("pro")
u_list = portal.users.search(query=None, max_users=1000)  # get everyone 
#portal_roles = portal.users.roles.all()

for u in u_list :
    last_login = ""
    last_login_conv = convertPortalDate(u.lastLogin)
    if (not(type(last_login_conv) == int)) : last_login = getShortDate(last_login_conv)
    print('"%s","%s","%s","%s","%s"' % (u.username, last_login, u.disabled, u.role, u.user_types()["id"]))
#------------------------------------------------------------------------------------------
Katie_Clark
MVP Alum

This post helped me a lot and so I wanted to add to it, with a link to specific Esri documentation. It basically says the same thing in the GeoJobe link, but also provides other information that might be useful for other user properties:

Katie_Clark_0-1766091207454.png

userType determines if new members will have Esri access (both) or if Esri access will be disabled (arcgisonly). The default value is arcgisonly. 

ArcGIS REST API

https://developers.arcgis.com/rest/users-groups-and-items/set-user-default-settings/

ArcGIS API for Python (arcgis.gis.User.user_types)

https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.User.user_t... 

For me, what I really needed was the userLicenseType value from the REST API, which is what you get with the User.user_types()["id"] call mentioned by @RHmapping 

 

 

Best,
Katie

If this answer helped you, please consider giving a kudos and/or marking as the accepted solution. Thanks!
0 Kudos