Class: UserModel

UserModel()

new UserModel()

Source:

Extends

  • Backbone.Model

Methods

checkQuota(action, customerGroup)

Checks if this user has the quota to perform the given action
Parameters:
Name Type Description
action string The action to be performed
customerGroup string The subject or identifier of the customer/membership group to use this quota against
Source:

createFetchSettings() → {object}

Creates the settings object to be used in a fetch() call to the DataONE API
Source:
Returns:
The settings object to be passed to the fetch() function
Type
object

fetchSubscription()

Retrieve all the info about this user's DataONE Subscription
Source:

getQuotas(typeopt) → {Array.<Quota>}

Gets the already-fetched Quotas for the User, filters down to the type given, and returns them.
Parameters:
Name Type Attributes Description
type string <optional>
The Quota type to return
Source:
Returns:
The filtered array of Quota models or an empty array, if none are found
Type
Array.<Quota>

getTokenPromise(timeoutopt) → {Promise.<string>}

Returns a promise that resolves with the token when it is retrieved.
Parameters:
Name Type Attributes Description
timeout number <optional>
The time in milliseconds to wait for the token before rejecting the promise.
Source:
Returns:
A promise that resolves with the token or rejects with an error message.
Type
Promise.<string>

hasIdentityOverlap(subjects) → {boolean}

Given a list of user and/or group subjects, this function checks if this user has an equivalent identity in that list, or is a member of a group in the list. A single subject string can be passed instead of an array of subjects. TODO: This needs to support nested group membership.
Parameters:
Name Type Description
subjects string | Array.<string>
Source:
Returns:
Type
boolean

isAuthorizedCreatePortal()

Checks if the user has authorization to perform the given action.
Source: