AnsweredAssumed Answered

Get new user types with python api for ArcGIS?

Question asked by psba_ldudina on Jul 4, 2019
Latest reply on Jul 21, 2019 by psba_ldudina

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. 

new user types on AGOL

 

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)

Outcomes