<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Not Able to Get All Roles (Default Built-In) in Portal Using ArcGIS Python API in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-all-roles-default-built-in-in/m-p/1692857#M11895</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/671830"&gt;@BHK&lt;/a&gt;&amp;nbsp;I know this is ancient, but in case anyone else comes across this while surfing the web for answers—the default Admin, Publisher, and User roles &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#rolemanager:~:text=The%20all%20method%20provides%20a%20list%20containing%20the%20default%20Viewer%20and%20Data%20Editor%20roles%2C%20plus%20any%20custom%20roles%20defined%20in%20the%20GIS.%20(The%20org_admin%2C%20org_user%2C%20and%20org_publisher%20default%20roles%20are%20not%20returned.%20See%20Default%20roles%20for%20detailed%20descriptions%20of%20each%20role.)" target="_self"&gt;are handled differently&lt;/A&gt;. Not sure why, probably legacy stuff from when ArcGIS Online was first launched. While custom roles and later default Esri roles (Viewer, Data Editor) have a random 16-character id and a RoleObject you can read, the ID for these three original roles are org_admin, org_publisher, and org_user.&amp;nbsp; They behave differently and you can't pull the same info on them through gis.users.roles.all() as you can with the others, which have associated role objects.&amp;nbsp;You can see these if you pull up a specific user with one of these three roles and check their roleid (see example below).&lt;/P&gt;&lt;P&gt;If you want to pull the privileges for those 3 default roles, you can pull an existing user who has that account type and get it from there. I don't know of a way to get it without going through an existing user who has those default roles&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import gis
from arcgis.gis import GIS

gis = GIS(url = 'your_portal_url', username = 'your_username', password = 'your_password')

### Inspect org roleIds, remove the query to see all roles, and how these defaults compare with custom roles
for user in gis.users.search(query="role:org_admin"):
    print(user.roleId)

### If you try to get the roleobject for one of these default roles, you'll get None in return. Whereas if you put in the id of a custom role (like you are in your example) you can pull name, description, privileges, etc.
roleobject =  gis.users.roles.get_role('org_admin')
print(roleobject)

# Get all possible privileges via admin
for user in gis.users.search(query="role:org_admin", max_users=1):
    full_priv_list = user.privileges

# Get privileges for all 3 default roles
primary_default_roles = ['org_admin', 'org_publisher', 'org_user']
for dr in primary_default_roles:
    for user in gis.users.search(query = f'role:{dr}', max_users = 1):
        print(user.roleId)
        priv_list = user.privileges
        print(priv_list)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2026 19:53:00 GMT</pubDate>
    <dc:creator>AaronKoelker</dc:creator>
    <dc:date>2026-03-26T19:53:00Z</dc:date>
    <item>
      <title>Not Able to Get All Roles (Default Built-In) in Portal Using ArcGIS Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-all-roles-default-built-in-in/m-p/1537453#M10648</link>
      <description>&lt;P&gt;I am using this ArcGIS Python API to list all roles and their associated&amp;nbsp; Privileges with this Code but this is ONLY and ONLY listing custom Roles and not default roles like (Administrator, Publisher,Creator .. )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;roles = gis.users.roles.&lt;SPAN class=""&gt;all&lt;/SPAN&gt;()
&lt;SPAN class=""&gt;# Print roles&lt;/SPAN&gt;
&lt;SPAN class=""&gt;for&lt;/SPAN&gt; role &lt;SPAN class=""&gt;in&lt;/SPAN&gt; roles:
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"Role Name: &lt;SPAN class=""&gt;{role['name']}&lt;/SPAN&gt;, Role ID: &lt;SPAN class=""&gt;{role['id']}&lt;/SPAN&gt;, Role Description: &lt;SPAN class=""&gt;{role['description']}&lt;/SPAN&gt;"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;Can you please let me know why this is happening? and how I can get all&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 17:47:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-all-roles-default-built-in-in/m-p/1537453#M10648</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-09-11T17:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get All Roles (Default Built-In) in Portal Using ArcGIS Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-all-roles-default-built-in-in/m-p/1692857#M11895</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/671830"&gt;@BHK&lt;/a&gt;&amp;nbsp;I know this is ancient, but in case anyone else comes across this while surfing the web for answers—the default Admin, Publisher, and User roles &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#rolemanager:~:text=The%20all%20method%20provides%20a%20list%20containing%20the%20default%20Viewer%20and%20Data%20Editor%20roles%2C%20plus%20any%20custom%20roles%20defined%20in%20the%20GIS.%20(The%20org_admin%2C%20org_user%2C%20and%20org_publisher%20default%20roles%20are%20not%20returned.%20See%20Default%20roles%20for%20detailed%20descriptions%20of%20each%20role.)" target="_self"&gt;are handled differently&lt;/A&gt;. Not sure why, probably legacy stuff from when ArcGIS Online was first launched. While custom roles and later default Esri roles (Viewer, Data Editor) have a random 16-character id and a RoleObject you can read, the ID for these three original roles are org_admin, org_publisher, and org_user.&amp;nbsp; They behave differently and you can't pull the same info on them through gis.users.roles.all() as you can with the others, which have associated role objects.&amp;nbsp;You can see these if you pull up a specific user with one of these three roles and check their roleid (see example below).&lt;/P&gt;&lt;P&gt;If you want to pull the privileges for those 3 default roles, you can pull an existing user who has that account type and get it from there. I don't know of a way to get it without going through an existing user who has those default roles&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import gis
from arcgis.gis import GIS

gis = GIS(url = 'your_portal_url', username = 'your_username', password = 'your_password')

### Inspect org roleIds, remove the query to see all roles, and how these defaults compare with custom roles
for user in gis.users.search(query="role:org_admin"):
    print(user.roleId)

### If you try to get the roleobject for one of these default roles, you'll get None in return. Whereas if you put in the id of a custom role (like you are in your example) you can pull name, description, privileges, etc.
roleobject =  gis.users.roles.get_role('org_admin')
print(roleobject)

# Get all possible privileges via admin
for user in gis.users.search(query="role:org_admin", max_users=1):
    full_priv_list = user.privileges

# Get privileges for all 3 default roles
primary_default_roles = ['org_admin', 'org_publisher', 'org_user']
for dr in primary_default_roles:
    for user in gis.users.search(query = f'role:{dr}', max_users = 1):
        print(user.roleId)
        priv_list = user.privileges
        print(priv_list)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 19:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-all-roles-default-built-in-in/m-p/1692857#M11895</guid>
      <dc:creator>AaronKoelker</dc:creator>
      <dc:date>2026-03-26T19:53:00Z</dc:date>
    </item>
  </channel>
</rss>

