what is the userType in a User resource?

883
2
10-23-2017 08:59 AM
TerryGiles
Occasional Contributor III

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

0 Kudos
2 Replies
DeniseKing
Esri Regular Contributor

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

RHmapping
New Contributor II

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"]))
#------------------------------------------------------------------------------------------
0 Kudos