<?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>idea Restrict edits to specific fields based on DB role in Attribute Rules Ideas</title>
    <link>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idi-p/1371179</link>
    <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1; Oracle 18c 10.7.1 EGDB&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I want to provide a staff department with editing rights to specific fields in a feature class. Rather than set up an attribute rule based on a list of hardcoded user names, I'd like to utilize an existing &lt;A href="https://www.techonthenet.com/oracle/roles.php" target="_self"&gt;Oracle role&lt;/A&gt;&amp;nbsp;(group of users) in an attribute rule.&lt;/P&gt;&lt;P&gt;I'm aware that an alternative is to create a related table with separate DB privileges. I don't want to do that in this case since it adds complexity in terms of editing and data management. If the relationship is 1:1, it would be cleanest to add additional fields to the FC rather than separate them into a related table.&lt;/P&gt;&lt;P&gt;Could functionality be added to attribute rules that lets me restrict edits to specific fields based on a DB role?&lt;/P&gt;&lt;P&gt;Use case:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/prevent-edits-to-specific-fields-and-manage-a/m-p/1368060/highlight/true#M77163" target="_self"&gt;Prevent edits to specific fields (and manage a report)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 02:48:17 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-01-18T02:48:17Z</dc:date>
    <item>
      <title>Restrict edits to specific fields based on DB role</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idi-p/1371179</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1; Oracle 18c 10.7.1 EGDB&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I want to provide a staff department with editing rights to specific fields in a feature class. Rather than set up an attribute rule based on a list of hardcoded user names, I'd like to utilize an existing &lt;A href="https://www.techonthenet.com/oracle/roles.php" target="_self"&gt;Oracle role&lt;/A&gt;&amp;nbsp;(group of users) in an attribute rule.&lt;/P&gt;&lt;P&gt;I'm aware that an alternative is to create a related table with separate DB privileges. I don't want to do that in this case since it adds complexity in terms of editing and data management. If the relationship is 1:1, it would be cleanest to add additional fields to the FC rather than separate them into a related table.&lt;/P&gt;&lt;P&gt;Could functionality be added to attribute rules that lets me restrict edits to specific fields based on a DB role?&lt;/P&gt;&lt;P&gt;Use case:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/prevent-edits-to-specific-fields-and-manage-a/m-p/1368060/highlight/true#M77163" target="_self"&gt;Prevent edits to specific fields (and manage a report)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 02:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idi-p/1371179</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-18T02:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict edits to specific fields based on DB role</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idc-p/1371262#M196</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;One way you can do this is a lookup table instead in the DB.&lt;BR /&gt;&lt;BR /&gt;Create a constraint rule to look up the &lt;A href="https://developers.arcgis.com/arcade/function-reference/portal_functions/#getuser" target="_self"&gt;username&lt;/A&gt;&amp;nbsp;then query that table for a match and depending on your logic allow or reject that edit&lt;/P&gt;&lt;P&gt;~ Jake&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 21:07:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idc-p/1371262#M196</guid>
      <dc:creator>Jake_S</dc:creator>
      <dc:date>2024-01-17T21:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict edits to specific fields based on DB role</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idc-p/1371306#M197</link>
      <description>&lt;P&gt;I second the comment by JS_ESRI.&lt;/P&gt;&lt;P&gt;I do a similar thing where I want to restrict editing of certain records in a table to specific users.&amp;nbsp; In my case I have two validation tables: 1) a superuser table for the support team names 2) an maintuser (editor) table.&lt;/P&gt;&lt;P&gt;If the current user is in the superuser table they can edit any record.&lt;/P&gt;&lt;P&gt;If the user is in the maintuser table and the current record corresponds to their currently selected record, then the edit is allowed to proceed.&lt;/P&gt;&lt;P&gt;Code is below for reference. (Don't judge too harshly)&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;var curUser = GetUser($featureSet).username&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var loadTab = $feature.LOAD_INSTANCE+"."+$feature.LOAD_OBJECT_OWNER+"."+$feature.LOAD_OBJECT_NAME&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//check if user is in the superuser tab&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//Parse curUser to strip out @coc and convert to uppercase&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var idx = Find("@",curUser)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if (idx &amp;gt; -1){&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;curUser = Split(curUser,"@")[0];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//Check if user in superuse table&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var superTab = FeatureSetByName($datastore,'GBS_UTIL.COC_METADATA.METADATA_SUPERUSERS', ['*'], false);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var superSQL = "UPPER(USERNAME) = UPPER('" + curUser + "')";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//run the query&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var foundRecs = Filter(superTab, superSQL);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var superCount = Count(foundRecs);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//If user is in superuser table then return tru and allow edit, no need to go further&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if (superCount &amp;gt; 0) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;//return {"errorMessage":"Current was in SuperUserTable:"+curUser+ " count is:"+superCount}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;return true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;//If not in SuperUser table then check privs.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;//check if curUser is in an editor:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var maintTab = FeatureSetByName($datastore,"GBS_UTIL.COC_METADATA.METADATA_EDITORS_V", ["*"], false);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var maintSQL = " LOAD_OBJECT_FULLNAME = '"+loadTab+"' "+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;"AND "+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;"(PORTAL_USER = '"+curUser+"' "+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;"OR DB_USERNAME = '"+curUser+"' "+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;"OR DB_ALIAS = '"+curUser+"' "+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;")"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;//run the query&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var foundMaintRecs = Filter(maintTab, maintSQL);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;var maintCount = Count(foundMaintRecs);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//If user is in superuser table then continue and allow edit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if (maintCount == 0) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;return {"errorMessage":"Current user does not have maint privs on the table. \n "+curUser+" has no privs on "+loadTab+ "maintCount "+maintCount}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;//If you get to here without a prior return then return true to allow editing&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;return true&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 21:42:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/restrict-edits-to-specific-fields-based-on-db-role/idc-p/1371306#M197</guid>
      <dc:creator>AllanBenvin_yyc</dc:creator>
      <dc:date>2024-01-17T21:42:51Z</dc:date>
    </item>
  </channel>
</rss>

