<?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: Current logged in user and permissions in Experience Builder Custom Widgets</title>
    <link>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1248509#M56</link>
    <description>&lt;P&gt;This is great.&amp;nbsp; Thank you so much for this information.&amp;nbsp; This is exactly what I was looking for.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2023 17:24:06 GMT</pubDate>
    <dc:creator>MatthewClockel</dc:creator>
    <dc:date>2023-01-16T17:24:06Z</dc:date>
    <item>
      <title>Current logged in user and permissions</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1247383#M54</link>
      <description>&lt;P&gt;I am building a custom widget that recognizes the logged in user so this can be applied to the UI.&amp;nbsp; My goal is for the application to recognize the current logged in user and display information on the tables and pages that pertains to the particular user.&amp;nbsp; So far I was able to create a custom widget that displays the username of the logged in user.&amp;nbsp; &amp;nbsp; Any one have any experience with this and can help develop this.&amp;nbsp; This would be very useful for Esri experience builder users.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far this is the code for the custom widget that displays the current user.&amp;nbsp; This is the widget.tsx file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/** @jsx jsx */
import lang from "esri/core/lang";
import Credential from "esri/identity/Credential";
import IdentityManager from "esri/identity/IdentityManager";
import { React, AllWidgetProps, jsx, portalUtils, SessionManager } from "jimu-core";
import { getAppStore } from 'jimu-core';
import { userInfo } from "os";
import { userSignIn } from "../../../../../jimu-core/lib/app-actions";


export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;any&amp;gt;, any&amp;gt; {

    render() {
        let state = getAppStore().getState().user.username;
        return &amp;lt;div&amp;gt;{state}&amp;lt;/div&amp;gt;;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When this widget is dragged into the UI of the application, the user name is displayed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 18:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1247383#M54</guid>
      <dc:creator>MatthewClockel</dc:creator>
      <dc:date>2023-01-11T18:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Current logged in user and permissions</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1247393#M55</link>
      <description>&lt;P&gt;If you want all the details related to a user, and the user has logged in, then you can obtain these details by making a call to the portal/self end point. See the REST API details here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/self.htm" target="_blank" rel="noopener"&gt;portal/self&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will return a detailed object for the user, including the users privileges and the groups that they are a member of.&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;   getUserDetails = (resp) =&amp;gt; { 
let token = this.props.token;
        const userUrl = this.props.portalUrl + '/sharing/rest/community/self?token=' + token + '&amp;amp;f=json'

        fetch(userUrl, {            
        }).then(
            response =&amp;gt; response.json()
        ).then((data: any) =&amp;gt; {
            this.parseGetUserDetails(data);
        })
            // Catch any errors we hit and update the app
            .catch((error: any) =&amp;gt; {
                console.error(error);
                return null;

            });
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Jan 2023 19:09:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1247393#M55</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2023-01-11T19:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Current logged in user and permissions</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1248509#M56</link>
      <description>&lt;P&gt;This is great.&amp;nbsp; Thank you so much for this information.&amp;nbsp; This is exactly what I was looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 17:24:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1248509#M56</guid>
      <dc:creator>MatthewClockel</dc:creator>
      <dc:date>2023-01-16T17:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Current logged in user and permissions</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1363500#M170</link>
      <description>&lt;P&gt;I believe, user details can be fetched from&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.props.user&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Dec 2023 10:27:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/current-logged-in-user-and-permissions/m-p/1363500#M170</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2023-12-21T10:27:53Z</dc:date>
    </item>
  </channel>
</rss>

