<?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: Check if the user logged in to ArcGIS Online or Portal in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/check-if-the-user-logged-in-to-arcgis-online-or/m-p/1467338#M39497</link>
    <description>&lt;P&gt;There is still no straigth forward approch for this but I think I found a work around by getting the current user role in the portal information.&amp;nbsp;&lt;BR /&gt;If the user is not signed-in the value in the role key will be empty string (''). Once the user is signed-in, it's role will be set in the portal info dictionary.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy import GetPortalInfo, GetActivePortalURL

def portal_sign_in_check() -&amp;gt; None:
    portal_info: dict = GetPortalInfo(portal_URL = GetActivePortalURL())
    if portal_info['role'] == '':
        print('User is not signed-in to portal')
    else:
        print('User is signed-in to portal')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Example of the portal info dictionary when the user is not signed-in:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{'SSL_enabled': False, 'portal_version': 9.2, 'role': '', 'organization': 'My Organization', 'organization_type': ''}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of the portal info dictionary when the user is signed-in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{'SSL_enabled': True, 'portal_version': 9.2, 'role': 'org_admin', 'organization': 'My Oraganization', 'organization_type': ''}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 18:59:26 GMT</pubDate>
    <dc:creator>Ofir_Mazor</dc:creator>
    <dc:date>2024-05-14T18:59:26Z</dc:date>
    <item>
      <title>Check if the user logged in to ArcGIS Online or Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/check-if-the-user-logged-in-to-arcgis-online-or/m-p/107845#M4196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Is there a way to check if the user logged in to ArcGIS Online or Portal in Python API&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script that publishes zipped shp files to my portal, but before publishing, I would like to check if I am logged in and authenticated to publish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for now, I am using &lt;EM&gt;gis.users.me&lt;/EM&gt;&amp;nbsp; which returns None if am not logged in, but looking for something different than this&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS
gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:31:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/check-if-the-user-logged-in-to-arcgis-online-or/m-p/107845#M4196</guid>
      <dc:creator>AhmadSALEH1</dc:creator>
      <dc:date>2021-12-11T06:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the user logged in to ArcGIS Online or Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/check-if-the-user-logged-in-to-arcgis-online-or/m-p/1467338#M39497</link>
      <description>&lt;P&gt;There is still no straigth forward approch for this but I think I found a work around by getting the current user role in the portal information.&amp;nbsp;&lt;BR /&gt;If the user is not signed-in the value in the role key will be empty string (''). Once the user is signed-in, it's role will be set in the portal info dictionary.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy import GetPortalInfo, GetActivePortalURL

def portal_sign_in_check() -&amp;gt; None:
    portal_info: dict = GetPortalInfo(portal_URL = GetActivePortalURL())
    if portal_info['role'] == '':
        print('User is not signed-in to portal')
    else:
        print('User is signed-in to portal')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Example of the portal info dictionary when the user is not signed-in:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{'SSL_enabled': False, 'portal_version': 9.2, 'role': '', 'organization': 'My Organization', 'organization_type': ''}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of the portal info dictionary when the user is signed-in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{'SSL_enabled': True, 'portal_version': 9.2, 'role': 'org_admin', 'organization': 'My Oraganization', 'organization_type': ''}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 18:59:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/check-if-the-user-logged-in-to-arcgis-online-or/m-p/1467338#M39497</guid>
      <dc:creator>Ofir_Mazor</dc:creator>
      <dc:date>2024-05-14T18:59:26Z</dc:date>
    </item>
  </channel>
</rss>

