<?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: Python script to list Privileges in Geodatabase by Feature Class in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315020#M8522</link>
    <description>&lt;P&gt;For anyone using Oracle, here's a post that uses a SQL query to list table privileges:&lt;BR /&gt;&lt;A href="https://dba.stackexchange.com/questions/187229/how-to-audit-table-permissions-as-a-non-dba" target="_self"&gt;How to audit table permissions as a non-DBA&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;select&lt;/SPAN&gt; table_name, grantee , 
        &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(sel) sel, &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(ins) ins , &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(upd) upd, &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(del) del,
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(other_privs) &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;null&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'other'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; other_privs,
        &lt;SPAN class=""&gt;listagg&lt;/SPAN&gt;(other_privs,&lt;SPAN class=""&gt;','&lt;/SPAN&gt;) &lt;SPAN class=""&gt;within&lt;/SPAN&gt; &lt;SPAN class=""&gt;group&lt;/SPAN&gt; (&lt;SPAN class=""&gt;order&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; other_privs) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; list_of_other_privs
 &lt;SPAN class=""&gt;from&lt;/SPAN&gt; 
 (&lt;SPAN class=""&gt;select&lt;/SPAN&gt; table_name, grantee, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'SELECT'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; sel, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'INSERT'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; ins, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'UPDATE'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; upd, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'DELETE'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; del,
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; (&lt;SPAN class=""&gt;'SELECT'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'INSERT'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'UPDATE'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'DELETE'&lt;/SPAN&gt;) &lt;SPAN class=""&gt;then&lt;/SPAN&gt; privilege &lt;SPAN class=""&gt;end&lt;/SPAN&gt; other_privs 
   &lt;SPAN class=""&gt;from&lt;/SPAN&gt; user_tab_privs
 ) 
  &lt;SPAN class=""&gt;group&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; table_name, grantee 
  &lt;SPAN class=""&gt;order&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; table_name, grantee&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1691069793302.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/77198iD3EFAE35387B8298/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1691069793302.png" alt="Bud_1-1691069793302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You could make a similar post (but for SQL Server) on Stack Overflow or DBA Stack Exchange, and likely get a good answer.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2023 13:37:28 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-08-03T13:37:28Z</dc:date>
    <item>
      <title>Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1314555#M8520</link>
      <description>&lt;P&gt;Hello.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having no luck finding a python snippet or example of how to list out privileges for the geodatabase. ChatGPT hasn't provided accurate coding either. If anyone can share how to do this then I would be very appreciative.&amp;nbsp; We use SQL server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 13:58:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1314555#M8520</guid>
      <dc:creator>ShariF</dc:creator>
      <dc:date>2023-08-02T13:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315020#M8522</link>
      <description>&lt;P&gt;For anyone using Oracle, here's a post that uses a SQL query to list table privileges:&lt;BR /&gt;&lt;A href="https://dba.stackexchange.com/questions/187229/how-to-audit-table-permissions-as-a-non-dba" target="_self"&gt;How to audit table permissions as a non-DBA&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;select&lt;/SPAN&gt; table_name, grantee , 
        &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(sel) sel, &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(ins) ins , &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(upd) upd, &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(del) del,
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; &lt;SPAN class=""&gt;max&lt;/SPAN&gt;(other_privs) &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;null&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'other'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; other_privs,
        &lt;SPAN class=""&gt;listagg&lt;/SPAN&gt;(other_privs,&lt;SPAN class=""&gt;','&lt;/SPAN&gt;) &lt;SPAN class=""&gt;within&lt;/SPAN&gt; &lt;SPAN class=""&gt;group&lt;/SPAN&gt; (&lt;SPAN class=""&gt;order&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; other_privs) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; list_of_other_privs
 &lt;SPAN class=""&gt;from&lt;/SPAN&gt; 
 (&lt;SPAN class=""&gt;select&lt;/SPAN&gt; table_name, grantee, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'SELECT'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; sel, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'INSERT'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; ins, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'UPDATE'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; upd, 
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'DELETE'&lt;/SPAN&gt; &lt;SPAN class=""&gt;then&lt;/SPAN&gt; &lt;SPAN class=""&gt;'y'&lt;/SPAN&gt; &lt;SPAN class=""&gt;end&lt;/SPAN&gt; del,
        &lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;when&lt;/SPAN&gt; privilege &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; (&lt;SPAN class=""&gt;'SELECT'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'INSERT'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'UPDATE'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'DELETE'&lt;/SPAN&gt;) &lt;SPAN class=""&gt;then&lt;/SPAN&gt; privilege &lt;SPAN class=""&gt;end&lt;/SPAN&gt; other_privs 
   &lt;SPAN class=""&gt;from&lt;/SPAN&gt; user_tab_privs
 ) 
  &lt;SPAN class=""&gt;group&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; table_name, grantee 
  &lt;SPAN class=""&gt;order&lt;/SPAN&gt; &lt;SPAN class=""&gt;by&lt;/SPAN&gt; table_name, grantee&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1691069793302.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/77198iD3EFAE35387B8298/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1691069793302.png" alt="Bud_1-1691069793302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You could make a similar post (but for SQL Server) on Stack Overflow or DBA Stack Exchange, and likely get a good answer.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 13:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315020#M8522</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-08-03T13:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315122#M8523</link>
      <description>&lt;P&gt;You can use SQL Server Management Studio to see the permissions.&lt;BR /&gt;Example:&lt;/P&gt;&lt;P&gt;--Verify role permissions&lt;BR /&gt;select dp.NAME AS principal_name,&lt;BR /&gt;dp.type_desc AS principal_type_desc,&lt;BR /&gt;o.NAME AS object_name,&lt;BR /&gt;p.permission_name,&lt;BR /&gt;p.state_desc AS permission_state_desc&lt;BR /&gt;from sys.database_permissions p&lt;BR /&gt;left OUTER JOIN sys.all_objects o&lt;BR /&gt;on p.major_id = o.OBJECT_ID&lt;BR /&gt;inner JOIN sys.database_principals dp&lt;BR /&gt;on p.grantee_principal_id = dp.principal_id&lt;BR /&gt;where dp.NAME = 'gis_sde_owner'&lt;BR /&gt;GO&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;--Verify User permissions&lt;BR /&gt;select USER_NAME(p.grantee_principal_id) AS principal_name,&lt;BR /&gt;dp.type_desc AS principal_type_desc,&lt;BR /&gt;p.class_desc,&lt;BR /&gt;OBJECT_NAME(p.major_id) AS object_name,&lt;BR /&gt;p.permission_name,&lt;BR /&gt;p.state_desc AS permission_state_desc&lt;BR /&gt;from sys.database_permissions p&lt;BR /&gt;inner JOIN sys.database_principals dp&lt;BR /&gt;on p.grantee_principal_id = dp.principal_id&lt;BR /&gt;where USER_NAME(p.grantee_principal_id) = 'sde'&lt;BR /&gt;GO&lt;BR /&gt;&lt;BR /&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 16:06:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315122#M8523</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2023-08-03T16:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315238#M8524</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/662595"&gt;@ShariF&lt;/a&gt;&amp;nbsp;- see this python script example, it might give you some ideas.&lt;BR /&gt;&lt;A href="https://gis.stackexchange.com/questions/73991/checking-current-user-privileges-for-arcsde-dataset-with-arcpy" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/73991/checking-current-user-privileges-for-arcsde-dataset-with-arcpy&lt;/A&gt;&lt;BR /&gt;This article is quite old though. But take a look at the arcpy API documentation, it might have some new method available.&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/api-reference/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you do not find what you are looking for then I encourage you to open a support ticket with Esri Technical Support.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 19:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1315238#M8524</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2023-08-03T19:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1316011#M8525</link>
      <description>&lt;P&gt;Thank you. I'm a newbie with SQL server studio and will give this a try.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 13:39:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1316011#M8525</guid>
      <dc:creator>ShariF</dc:creator>
      <dc:date>2023-08-07T13:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to list Privileges in Geodatabase by Feature Class</title>
      <link>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1316013#M8526</link>
      <description>&lt;P&gt;Thank you. I found that article too but had no luck getting it to work.&amp;nbsp; Maybe with arcpy.ARCSDESQExecute&amp;nbsp; and the previous answer provided I can get something working.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 13:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/python-script-to-list-privileges-in-geodatabase-by/m-p/1316013#M8526</guid>
      <dc:creator>ShariF</dc:creator>
      <dc:date>2023-08-07T13:43:34Z</dc:date>
    </item>
  </channel>
</rss>

