Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: PortalUser

require(["esri/arcgis/Portal"], function(arcgisPortal) { /* code goes here */ });

Description

(Added at v2.8)
Represents a registered user of the Portal. Personal details of the user, such as email and groups, are returned only to the user or the administrator of the user's organization. A user is not visible to any other users (except their organization's administrator) if their access setting is set to 'private'. View the ArcGIS Portal API REST documentation for the user for more details.

Samples

Search for samples that use this class.

Properties

NameTypeSummary
accessStringThe access level for the user: private, org or public.
createdDateThe date the user was created.
cultureStringThe default culture for the user.
descriptionStringDescription of the user.
emailStringThe user's email address.
fullNameStringThe user's full name.
modifiedDateThe date the user was modified.
orgIdStringThe id of the organization the user belongs to.
portalPortalThe portal.
preferredViewStringThe user's preferred view for content, either Web or GIS.
regionStringThe user's preferred region, used to set the featured maps on the portal home page, content in the gallery and the default extent for new maps in the Viewer.
roleStringThe user's role in the organization: administrator (org_admin), publisher (org_publisher), or user (org_user).
tagsString[]User-defined tags that describe the user.
thumbnailUrlStringThe url to the thumbnail image for the user.
userContentUrlStringThe URL for the user content.
usernameStringThe username for the user.

Methods

NameReturn typeSummary
getFolders()DeferredFind folders for the portal user.
getGroupInvitations()DeferredProvides access to the group invitations for the portal user.
getGroups()DeferredFind all the groups that the portal user has permissions to access.
getItem(itemId)DeferredGet the portal item along with folder info for the input item id.
getItems(folderId?)DeferredRetrieve all the items in the specified folder.
getNotifications()DeferredGet information about any notifications for the portal user.
getTags()DeferredAccess the tag objects that have been created by the portal user.
getThumbnailUrl(width?)StringGet the URL to the thumbnail image for the portal user.
Property Details

<String> access

The access level for the user: private, org or public. If private, the users descriptive information will not be available and the user name will not be searchable. Available only if the user is signed-in.
Known values: private | org | public

<Date> created

The date the user was created.

<String> culture

The default culture for the user.

<String> description

Description of the user.

<String> email

The user's email address. Available only if the user is signed-in.

<String> fullName

The user's full name.

<Date> modified

The date the user was modified.

<String> orgId

The id of the organization the user belongs to.

<Portal> portal

The portal.

<String> preferredView

The user's preferred view for content, either Web or GIS. Available only if the user is signed-in.

<String> region

The user's preferred region, used to set the featured maps on the portal home page, content in the gallery and the default extent for new maps in the Viewer.

<String> role

The user's role in the organization: administrator (org_admin), publisher (org_publisher), or user (org_user).

<String[]> tags

User-defined tags that describe the user.

<String> thumbnailUrl

The url to the thumbnail image for the user.

<String> userContentUrl

The URL for the user content. (Added at v3.2)

<String> username

The username for the user.
Method Details

getFolders()

Find folders for the portal user. Returns a deferred that when resolved provides access to an array of PortalFolder objects.
Return type: Deferred
Sample:
require([
  "dojo/_base/array", ... 
], function(array, ... ) {
  portalUser.getFolders().then(function(folders){
    array.forEach(folders,function(folder){
      if(folder.title === 'javascript'){
        folderid = folder.id;
      }
    });
  });
  ...
});

getGroupInvitations()

Provides access to the group invitations for the portal user. Returns a deferred that when resolved provides access to the results as json. View the REST API documentation for details on the result format.
Return type: Deferred

getGroups()

Find all the groups that the portal user has permissions to access. Returns a deferred that when resolved provides access to an array of PortalGroup objects.
Return type: Deferred
Sample:
require([
  "dojo/_base/array", ... 
], function(array, ... ) {
  portalUser.getGroups().then(function(groups){
    array.forEach(groups,function(group){
      var description = group.description;
    });
  });
  ...
});

getItem(itemId)

Get the portal item along with folder info for the input item id. (Added at v3.4)
Return type: Deferred
Parameters:
<String> itemId Required The id of the item.
Sample:
require(["esri/arcgis/Portal"],function(
  arcgisPortal
){
  function getItems(){
      loggedInUser.getItem("1084880a33cc4669a1afe8c298d46871").then(function(results){
        //do something with the info here.
      });
  }
....
});

getItems(folderId?)

Retrieve all the items in the specified folder. Returns a deferred that when resolved provides access to an array of PortalItem objects.
Return type: Deferred
Parameters:
<String> folderId Optional The id of the folder that contains the items to retrieve.
Sample:
require([
  "dojo/_base/array", ... 
], function(array, ... ) {
  function loadItems(id){
    portalUser.getItems(id).then(function(items){
      array.forEach(items,function(item){
        console.log(item);
      });
    });
  };
  ...
});

getNotifications()

Get information about any notifications for the portal user. Returns a deferred that when resolved provides access to the results as json. View the REST API documentation for details on the result format.
Return type: Deferred
Sample:

portalUser.getNotifications().then(function(notifications){

  var notificationTarget = notifications[0].target;

});

getTags()

Access the tag objects that have been created by the portal user. Returns a deferred that when resolved provides access to an array of tag objects used by the user. Each tag object contains a tag property with the name of the tag along with a count that reports the number of times the tag was used.
Return type: Deferred
Sample:
require([
  "dojo/_base/array", ... 
], function(array, ... ) {
  portalUser.getTags().then(function(tagItems){
    array.forEach(tagItems,function(tagItem){
      console.log(tagItem.tag);
    });
  });
  ...
});

getThumbnailUrl(width?)

Get the URL to the thumbnail image for the portal user.

Available width sizes: 150, 300 and 600. (Added at v3.21)
Return type: String
Parameters:
<Number> width Optional The desired image width.
Show Modal