<?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: ArcGIS enterpirse clone roles, users and groups in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1554684#M10836</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/302216"&gt;@NickXu&lt;/a&gt;&amp;nbsp;I too was not able to use the clone feature for either the group or roles. The environment I am in has version 10.9.1 Enterprise. Although in my org I use the code listed in &lt;A href="https://developers.arcgis.com/python/latest/samples/clone-a-group/#clone-the-group-in-the-target-portal-if-it-does-not-already-exist" target="_blank"&gt;https://developers.arcgis.com/python/latest/samples/clone-a-group/#clone-the-group-in-the-target-portal-if-it-does-not-already-exist&lt;/A&gt;&amp;nbsp;for cloning groups from one org to another. For cloning users from one org to another use the code in URL&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/samples/clone-portal-users-groups-and-content-rn/#copy-users" target="_blank"&gt;https://developers.arcgis.com/python/latest/samples/clone-portal-users-groups-and-content-rn/#copy-users&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For cloning a Role, I use the following codeblock:&lt;/P&gt;&lt;P&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;# source GIS details&lt;BR /&gt;source_gis = GIS(url="portal_url", username="portal admin username", password=input("Enter source GIS password: "))&lt;BR /&gt;print("source connected")&lt;/P&gt;&lt;P&gt;# target GIS details&lt;BR /&gt;target_gis = GIS(url="portal_url", username="portal admin username", password=input("Enter target GIS password: "))&lt;BR /&gt;print("target connected")&lt;/P&gt;&lt;P&gt;# other variables&lt;BR /&gt;Role_to_be_created = [&amp;lt;list all role IDS to be cloned&amp;gt;]&lt;/P&gt;&lt;P&gt;# find roles in source env&lt;BR /&gt;for roleid in Role_to_be_created:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; source_roles = source_gis.users.roles.get_role(roleid)&lt;/P&gt;&lt;P&gt;# Clone Role from one env to another&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if not target_gis.users.roles.exists(roleid):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;target_role = target_gis.users.roles.create(source_roles.name,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source_roles.description,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source_roles.privileges)&lt;/P&gt;&lt;P&gt;# display the role&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(target_role.name)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(target_role.privileges)&lt;/P&gt;&lt;P&gt;Note: Ensure to correct the indentation if you plan to use the script.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 14:13:36 GMT</pubDate>
    <dc:creator>Shawn_NG</dc:creator>
    <dc:date>2024-11-01T14:13:36Z</dc:date>
    <item>
      <title>ArcGIS enterpirse clone roles, users and groups</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1537859#M10655</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to clone roles, users and groups from one environment to another one. From document, there is a clone method for roleManager, groupManager and userManager.&amp;nbsp; &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#groupmanager" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#groupmanager&lt;/A&gt;&lt;/P&gt;&lt;P&gt;However, my code failed with message:&amp;nbsp;&lt;SPAN&gt;AttributeError: 'GroupManager' object has no attribute 'clone'&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;cloneGroups&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;srcGis&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;trgGis&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;srcGroupManager&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;srcGis&lt;/SPAN&gt;&lt;SPAN&gt;.groups&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;srcGroups&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;srcGroupManager&lt;/SPAN&gt;&lt;SPAN&gt;.search(&lt;/SPAN&gt;&lt;SPAN&gt;outside_org&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;False&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;max_groups&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;sort_field&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"owner"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;trgManager&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;trgGis&lt;/SPAN&gt;&lt;SPAN&gt;.groups&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;clonedTrgGroup&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;trgManager&lt;/SPAN&gt;&lt;SPAN&gt;.clone(&lt;/SPAN&gt;&lt;SPAN&gt;groups&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;srcGroups&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;skip_existing&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I search examples and all of them use copy method. Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1537859#M10655</guid>
      <dc:creator>NickXu</dc:creator>
      <dc:date>2024-09-12T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS enterpirse clone roles, users and groups</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1537957#M10658</link>
      <description>&lt;P&gt;It seems like you are on an older version of the API which does not have that feature. Try updating per documentation:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/install-and-set-up/#upgrade-package" target="_blank"&gt;Install and Setup | ArcGIS API for Python&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 19:46:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1537957#M10658</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-09-12T19:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS enterpirse clone roles, users and groups</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1540496#M10686</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using ArcPro 3.1 with&lt;/P&gt;&lt;P&gt;python 3.916 and&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcgis 2.1.0.2 py39_14 esri&lt;BR /&gt;arcgispro 3.1 0 esri&lt;BR /&gt;arcpy 3.1 py39_arcgispro_41759 [arcgispro] esri&lt;BR /&gt;arcpy-base 3.1 py39_41759 esri&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try to update arcgis to:&lt;/P&gt;&lt;P&gt;arcgis 2.3.1 py311_9 esri&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 17:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1540496#M10686</guid>
      <dc:creator>NickXu</dc:creator>
      <dc:date>2024-09-19T17:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS enterpirse clone roles, users and groups</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1554684#M10836</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/302216"&gt;@NickXu&lt;/a&gt;&amp;nbsp;I too was not able to use the clone feature for either the group or roles. The environment I am in has version 10.9.1 Enterprise. Although in my org I use the code listed in &lt;A href="https://developers.arcgis.com/python/latest/samples/clone-a-group/#clone-the-group-in-the-target-portal-if-it-does-not-already-exist" target="_blank"&gt;https://developers.arcgis.com/python/latest/samples/clone-a-group/#clone-the-group-in-the-target-portal-if-it-does-not-already-exist&lt;/A&gt;&amp;nbsp;for cloning groups from one org to another. For cloning users from one org to another use the code in URL&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/samples/clone-portal-users-groups-and-content-rn/#copy-users" target="_blank"&gt;https://developers.arcgis.com/python/latest/samples/clone-portal-users-groups-and-content-rn/#copy-users&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For cloning a Role, I use the following codeblock:&lt;/P&gt;&lt;P&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;# source GIS details&lt;BR /&gt;source_gis = GIS(url="portal_url", username="portal admin username", password=input("Enter source GIS password: "))&lt;BR /&gt;print("source connected")&lt;/P&gt;&lt;P&gt;# target GIS details&lt;BR /&gt;target_gis = GIS(url="portal_url", username="portal admin username", password=input("Enter target GIS password: "))&lt;BR /&gt;print("target connected")&lt;/P&gt;&lt;P&gt;# other variables&lt;BR /&gt;Role_to_be_created = [&amp;lt;list all role IDS to be cloned&amp;gt;]&lt;/P&gt;&lt;P&gt;# find roles in source env&lt;BR /&gt;for roleid in Role_to_be_created:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; source_roles = source_gis.users.roles.get_role(roleid)&lt;/P&gt;&lt;P&gt;# Clone Role from one env to another&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if not target_gis.users.roles.exists(roleid):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;target_role = target_gis.users.roles.create(source_roles.name,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source_roles.description,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source_roles.privileges)&lt;/P&gt;&lt;P&gt;# display the role&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(target_role.name)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(target_role.privileges)&lt;/P&gt;&lt;P&gt;Note: Ensure to correct the indentation if you plan to use the script.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 14:13:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-enterpirse-clone-roles-users-and-groups/m-p/1554684#M10836</guid>
      <dc:creator>Shawn_NG</dc:creator>
      <dc:date>2024-11-01T14:13:36Z</dc:date>
    </item>
  </channel>
</rss>

