PortalUser

Class: esri/portal/PortalUser
Inheritance: PortalUser Accessor
Since: ArcGIS API for JavaScript 4.0

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. View the ArcGIS Portal API REST documentation for the user for more details.

See also:

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummary
String

Indicates the level of access of the user.

more details
more details
Date

The date the user was created.

more details
more details
String

The culture information for the user.

more details
more details
String

The name of the class.

more details
more details
String

A description of the user.

more details
more details
String

The user's e-mail address.

more details
more details
String

The user's full name.

more details
more details
Date

The date the user was last modified.

more details
more details
String

The ID of the organization the user belongs to.

more details
more details
Portal

The portal associated with the user.

more details
more details
String

The user's preferred view for content, either web or GIS.

more details
more details
String

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

more details
more details
String

Defines the user's role in the organization.

more details
more details
String

The ID of the user's role.

more details
more details
String

The URL to the thumbnail image for the user.

more details
more details
String

The user's personal units of measure setting.

more details
more details
String

The URL for the user's content.

more details
more details
String

The username of the user.

more details
more details

Property Details

accessString

Indicates the level of access of the user. If private, the user descriptive information will not be available to others nor will the username be searchable.

Known Values: private | org | public

createdDate

The date the user was created.

cultureString

The culture information for the user.

declaredClassStringreadonly

The name of the class. The declared class name is formatted as esri.folder.className.

descriptionString

A description of the user.

emailString

The user's e-mail address.

fullNameString

The user's full name.

modifiedDate

The date the user was last modified.

orgIdString

The ID of the organization the user belongs to.

portalPortal

The portal associated with the user.

preferredViewString

The user's preferred view for content, either web or GIS.

regionString

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

roleString

Defines the user's role in the organization. See roleId for more details about when user has a custom role.

Known Values: org_admin | org_publisher | org_user

roleIdString

The ID of the user's role. Only set if the user is assigned a custom role.

When present, the role will indicate the "base" role of the custom role based on the privileges the custom role contains. For example, if the custom role contains some publisher privileges, the role will be set to org_publisher.

thumbnailUrlStringreadonly

The URL to the thumbnail image for the user.

See also:

unitsString

The user's personal units of measure setting. Possible values: english (corresponds to US standards) or metric.

userContentUrlStringreadonly

The URL for the user's content.

usernameString

The username of the user.

Method Overview

NameReturn TypeSummary
Promise

Adds an item to the user's portal content.

more details
more details
Promise

Deletes an item from the user's portal content.

more details
more details
Promise

Fetches all of the user's folders used to organize portal content.

more details
more details
Promise

Fetches all the groups that the portal user has permission to access.

more details
more details
Promise

Retrieves all the items in the specified folder.

more details
more details
String

Get the URL to the thumbnail image for the user.

more details
more details
Promise

Executes a query against the user's favorite group to return an array of PortalItem objects that match the input query.

more details
more details

Method Details

addItem(params){Promise}

Adds an item to the user's portal content.

Parameters:
params Object

See the object specifications table below for the parameters that may be passed as properties in this object.

Specification:

The item to add to the user's content.

data String | Object
optional

The component used to stream the data represented by the item to the client.

optional

The portal folder in which to store the item.

Returns:
TypeDescription
PromiseWhen resolved, returns the PortalItem to be added to the user's content.

deleteItem(item){Promise}

Deletes an item from the user's portal content.

Parameter:

The portal item to remove.

Returns:
TypeDescription
PromiseResolves when the item has been deleted from the user's content.

fetchFolders(){Promise}

Fetches all of the user's folders used to organize portal content.

Returns:
TypeDescription
PromiseResolves to an array of PortalFolder objects representing each of the user's folders in the portal.
Example:
// Once portal is loaded, user signed in
portal.load().then(function() {
  portalUser.fetchFolders().then(function(folders){
    folders.forEach(function(folder){
      console.log(" user folder", folder.title);
    });
  });
});

fetchGroups(){Promise}

Fetches all the groups that the portal user has permission to access.

Returns:
TypeDescription
PromiseResolves to an array of PortalGroup objects representing each group that the user can access.
Example:
// Once portal is loaded, user signed in
portal.load().then(function() {
  // fetch all the groups user can access
  portal.user.fetchGroups().then(function(fetchItemResult){
    console.log("user's groups: ", fetchItemResult);
  });
});

fetchItems(params){Promise}

Retrieves all the items in the specified folder.

Parameters:
params Object

See the object specifications table below for the parameters that may be passed as properties in this object.

Specification:

The folder to retrieve items from.

num Number

The maximum number of results to be included in the result set response. The maximum value allowed is 100. The start property combined with the num property can be used to paginate the search results.

Default Value: 10

start Number

The index of the first entry in the result set response. The index is 1-based.

Returns:
TypeDescription
PromiseResolves to an object with the following properties:
PropertyTypeDescription
itemsPortalItem[]An array containing user's portal items.
nextStartnumberThe next entry index if the current result set doesn't contain all results.
totalnumberThe total number of results.
Example:
// portalUser.fetchItems
portal.user.fetchItems().then(function(fetchItemResult){
   console.log("next start index: ", fetchItemResult.nextStart);
   fetchItemResult.items.forEach(function(item){
     console.log("portal item title:", item.title);
   });
});

getThumbnailUrl(width){String}

Since: ArcGIS API for JavaScript 4.4

Get the URL to the thumbnail image for the user.

Available width sizes: 150, 300 and 600.

Parameter:
width Number
optional

The desired image width.

Returns:
TypeDescription
StringThe URL to the thumbnail image.

queryFavorites(queryParams){Promise}

Executes a query against the user's favorite group to return an array of PortalItem objects that match the input query.

Parameter:
queryParams PortalQueryParams
optional

The input query parameters defined in PortalQueryParams. This object may be autocast.

Returns:
TypeDescription
PromiseWhen resolved, resolves to an instance of PortalQueryResult which contains a results array of PortalItem objects representing all the items that match the input query.

API Reference search results

NameTypeModule

There were no match results from your search criteria.