PortalUser

AMD: require(["esri/portal/PortalUser"], (PortalUser) => { /* code goes here */ });
ESM: import PortalUser from "@arcgis/core/portal/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.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

Indicates the level of access of the user.

more details
PortalUser
Date

The date the user was created.

more details
PortalUser
String

The culture information for the user.

more details
PortalUser
String

The name of the class.

more details
Accessor
String

A description of the user.

more details
PortalUser
String

The user's e-mail address.

more details
PortalUser
String

The user's full name.

more details
PortalUser
Date

The date the user was last modified.

more details
PortalUser
String

The ID of the organization the user belongs to.

more details
PortalUser
Portal

The portal associated with the user.

more details
PortalUser
String

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

more details
PortalUser
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
PortalUser
String

Defines the user's role in the organization.

more details
PortalUser
String

The ID of the user's role.

more details
PortalUser
Object

The JSON used to create the property values when the PortalUser is created.

more details
PortalUser
String

The URL to the thumbnail image for the user.

more details
PortalUser
String

The user's personal units of measure setting.

more details
PortalUser
String

The URL for the user's content.

more details
PortalUser
String

The username of the user.

more details
PortalUser

Property Details

access String

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.

Possible Values:"private"|"org"|"public"

created Date

The date the user was created.

culture String

The culture information for the user.

declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

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

description String

A description of the user.

email String

The user's e-mail address.

fullName String

The user's full name.

modified Date

The date the user was last modified.

orgId String

The ID of the organization the user belongs to.

portal Portal

The portal associated with the user.

preferredView String

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

region 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.

role String

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

Possible Values:"org_admin"|"org_publisher"|"org_user"

roleId String

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.

sourceJSON Object
Since: ArcGIS API for JavaScript 4.13

The JSON used to create the property values when the PortalUser is created. Although most commonly used properties are exposed on the PortalUser class directly, this provides access to all information returned for the portal user. This property is useful if working in an application built using an older version of the API which requires access to a portal's user properties from a more recent version.

See also
thumbnailUrl Stringreadonly

The URL to the thumbnail image for the user.

See also
units String

The user's personal units of measure setting.

Possible Values:"english"|"metric"

userContentUrl Stringreadonly

The URL for the user's content.

username String

The username of the user.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
Promise<PortalItem>

Adds an item to the user's portal content.

more details
PortalUser
Promise

Deletes an item from the user's portal content.

more details
PortalUser
Promise

Deletes items from the user's portal content.

more details
PortalUser
Promise<PortalFolder[]>

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

more details
PortalUser
Promise<PortalGroup[]>

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

more details
PortalUser
Promise<object>

Retrieves all the items in the specified folder.

more details
PortalUser
Promise<object[]>

Fetches the tag objects that have been created by the portal user.

more details
PortalUser
String

Get the URL to the thumbnail image for the user.

more details
PortalUser
Boolean

Returns true if a named group of handles exist.

more details
Accessor
Promise<PortalQueryResult>

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

more details
PortalUser

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

addItem(params){Promise<PortalItem>}

Adds an item to the user's portal content.

Parameters
Specification
params Object

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

Specification
item PortalItem

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
Type Description
Promise<PortalItem> When 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
item PortalItem

The portal item to remove.

Returns
Type Description
Promise Resolves when the item has been deleted from the user's content.
deleteItems(items){Promise}
Since: ArcGIS API for JavaScript 4.8

Deletes items from the user's portal content.

Parameter
items PortalItem[]

The portal items to remove.

Returns
Type Description
Promise Resolves when the items have been deleted from the user's content.
fetchFolders(){Promise<PortalFolder[]>}

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

Returns
Type Description
Promise<PortalFolder[]> Resolves 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<PortalGroup[]>}

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

Returns
Type Description
Promise<PortalGroup[]> Resolves 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<object>}

Retrieves all the items in the specified folder.

Parameters
Specification
params Object
optional

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

Specification
folder PortalFolder
optional

The folder to retrieve items from.

num Number
optional
Default Value: 10

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.

sortField String
optional
Default Value: created

A comma-delimited list of fields to sort by. Allowed values are created, modified, size, and type.

sortOrder String
optional
Default Value: asc

The order in which to sort the results. Allowed values are asc for ascending order and desc for descending order.

start Number
optional
Default Value: 1

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

Returns
Type Description
Promise<object> Resolves to an object with the following properties:
Property Type Description
items PortalItem[] An array containing user's portal items.
nextStart number The next entry index if the current result set doesn't contain all results.
total number The 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);
   });
});
fetchTags(){Promise<object[]>}
Since: ArcGIS API for JavaScript 4.14

Fetches the tag objects that have been created by the portal user.

Returns
Type Description
Promise<object[]> Resolves to an array of objects with the following properties:
Property Type Description
tag string The name of the tag.
count number The number of times the tag was used.
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
Type Description
String The URL to the thumbnail image.
hasHandles(groupKey){Boolean}inherited
Since: ArcGIS API for JavaScript 4.25

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
queryFavorites(queryParams){Promise<PortalQueryResult>}

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
Type Description
Promise<PortalQueryResult> When resolved, resolves to an instance of PortalQueryResult which contains a results array of PortalItem objects representing all the items that match the input query.
removeHandles(groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.