require(["esri/portal/PortalUser"], (PortalUser) => { /* code goes here */ });
import PortalUser from "@arcgis/core/portal/PortalUser.js";
esri/portal/PortalUser
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
Name | Type | Summary | Class |
---|---|---|---|
String | Indicates the level of access of the user. | PortalUser | |
Date | The date the user was created. | PortalUser | |
String | The culture information for the user. | PortalUser | |
String | The name of the class. | Accessor | |
String | A description of the user. | PortalUser | |
String | The user's e-mail address. | PortalUser | |
String | The user's full name. | PortalUser | |
Date | The date the user was last modified. | PortalUser | |
String | The ID of the organization the user belongs to. | PortalUser | |
Portal | The portal associated with the user. | PortalUser | |
String | The user's preferred view for content, either web or GIS. | PortalUser | |
String[] | The user's privileges based on their user type or role in their organization. | 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. | PortalUser | |
String | Defines the user's role in the organization. | PortalUser | |
String | The ID of the user's role. | PortalUser | |
Object | The JSON used to create the property values when the | PortalUser | |
String | The URL to the thumbnail image for the user. | PortalUser | |
String | The user's personal units of measure setting. | PortalUser | |
String | The URL for the user's content. | PortalUser | |
String | The username of the user. | PortalUser |
Property Details
-
access
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
created Date
-
The date the user was created.
-
culture
culture String
-
The culture information for the user.
-
description
description String
-
A description of the user.
-
email
email String
-
The user's e-mail address.
-
fullName
fullName String
-
The user's full name.
-
modified
modified Date
-
The date the user was last modified.
-
orgId
orgId String
-
The ID of the organization the user belongs to.
-
portal
portal Portal
-
The portal associated with the user.
-
preferredView
preferredView String
-
The user's preferred view for content, either web or GIS.
-
The user's privileges based on their user type or role in their organization.
-
region
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.
-
roleId
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
sourceJSON Object
Since: ArcGIS Maps SDK for JavaScript 4.13PortalUser since 4.0, sourceJSON added at 4.13. -
The JSON used to create the property values when the
PortalUser
is created. Although most commonly used properties are exposed on thePortalUser
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
thumbnailUrl Stringreadonly
-
The URL to the thumbnail image for the user.
- See also
-
units
units String
-
The user's personal units of measure setting.
Possible Values:"english"|"metric"
-
userContentUrl
userContentUrl Stringreadonly
-
The URL for the user's content.
-
username
username String
-
The username of the user.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Promise<PortalItem> | Adds an item to the user's portal content. | PortalUser | |
Promise | Deletes an item from the user's portal content. | PortalUser | |
Promise | Deletes items from the user's portal content. | PortalUser | |
Promise<PortalFolder[]> | Fetches all of the user's folders used to organize portal content. | PortalUser | |
Promise<PortalGroup[]> | Fetches all the groups that the portal user has permission to access. | PortalUser | |
Promise<object> | Retrieves all the items in the specified folder. | PortalUser | |
Promise<object[]> | Fetches the tag objects that have been created by the portal user. | PortalUser | |
String | Get the URL to the thumbnail image for the user. | PortalUser | |
Boolean | Returns true if a named group of handles exist. | Accessor | |
Promise<PortalQueryResult> | Executes a query against the user's favorite group to return an array of PortalItem objects that match the input query. | PortalUser | |
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 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 } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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
addItem(params){Promise<PortalItem>}
-
Adds an item to the user's portal content.
ParametersSpecificationparams ObjectSee the object specifications table below for the parameters that may be passed as properties in this object.
Specificationitem PortalItemThe item to add to the user's content.
optional The component used to stream the data represented by the item to the client.
folder String|PortalFolderoptionalThe portal folder in which to store the item.
ReturnsType Description Promise<PortalItem> When resolved, returns the PortalItem to be added to the user's content.
-
deleteItem
deleteItem(item){Promise}
-
Deletes an item from the user's portal content.
Parameteritem PortalItemThe portal item to remove.
ReturnsType Description Promise Resolves when the item has been deleted from the user's content.
-
deleteItems
deleteItems(items){Promise}
Since: ArcGIS Maps SDK for JavaScript 4.8PortalUser since 4.0, deleteItems added at 4.8. -
Deletes items from the user's portal content.
Parameteritems PortalItem[]The portal items to remove.
ReturnsType Description Promise Resolves when the items have been deleted from the user's content. - See also
-
fetchFolders
fetchFolders(){Promise<PortalFolder[]>}
-
Fetches all of the user's folders used to organize portal content.
ReturnsType 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
fetchGroups(){Promise<PortalGroup[]>}
-
Fetches all the groups that the portal user has permission to access.
ReturnsType 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); }); });
-
Retrieves all the items in the specified folder.
ParametersSpecificationparams ObjectoptionalSee the object specifications table below for the parameters that may be passed as properties in this object.
Specificationfolder PortalFolderoptionalThe folder to retrieve items from.
num NumberoptionalDefault Value: 10The 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 StringoptionalDefault Value: createdA comma-delimited list of fields to sort by. Allowed values are
created
,modified
,size
, andtype
.sortOrder StringoptionalDefault Value: ascThe order in which to sort the results. Allowed values are
asc
for ascending order anddesc
for descending order.start NumberoptionalDefault Value: 1The index of the first entry in the result set response. The index is 1-based.
ReturnsType 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); }); });
-
Since: ArcGIS Maps SDK for JavaScript 4.14PortalUser since 4.0, fetchTags added at 4.14. -
Fetches the tag objects that have been created by the portal user.
ReturnsType 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
getThumbnailUrl(width){String}
Since: ArcGIS Maps SDK for JavaScript 4.4PortalUser since 4.0, getThumbnailUrl added at 4.4. -
Get the URL to the thumbnail image for the user.
Available width sizes: 150, 300 and 600.
Parameterwidth NumberoptionalThe desired image width.
ReturnsType Description String The URL to the thumbnail image.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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
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.
ParameterqueryParams PortalQueryParamsoptionalThe input query parameters defined in PortalQueryParams. This object may be autocast.
ReturnsType 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.
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");