Auth0UserManager

Auth0UserManager

new Auth0UserManager()

Source:
Implements:
  • DatabaseInterface

Methods

(async, static) addNetworkToUser(id, network_id) → {Promise.<boolean>}

Source:
Adds a network to a user.
Parameters:
Name Type Description
id the id of the user.
network_id the id of the network.
Returns:
Type
Promise.<boolean>

(async, static) create(auth0_id) → {Promise.<(ObjectId|*)>}

Source:
Creates a user in the database for the specified auth0 id.
Parameters:
Name Type Description
auth0_id the auth0 id to make a user for.
Returns:
Type
Promise.<(ObjectId|*)>

(async, static) get(id) → {Promise.<Object>}

Source:
Gets the user with id.
Parameters:
Name Type Description
id string The id of the user (this is the id in the Spool database, not the auth0 id).
Returns:
A user object from the MongoDB.
Type
Promise.<Object>

(async, static) getAuth0User(user) → {Promise.<{Object}>}

Source:
Gets the auth0 user object (in the auth0 database) tied to a user.
Parameters:
Name Type Description
user Object the user to get the auth0 user for.
Returns:
The auth0 user object
Type
Promise.<{Object}>

(async, static) getByAuth0Id(auth0_id) → {Promise.<*>}

Source:
Gets a user from the database by their auth0 id.
Parameters:
Name Type Description
auth0_id the auth0 id of the user to get.
Returns:
Type
Promise.<*>

(async, static) getCollection() → {Object}

Source:
Helper function to get the collection of users.
Returns:
The MongoDB collection for users.
Type
Object

(async, static) removeNetworkFromUser(id, network_id) → {Promise.<boolean>}

Source:
Removes a network from a user.
Parameters:
Name Type Description
id the id of the user.
network_id the id of the network.
Returns:
Type
Promise.<boolean>

(async, static) resetUserPassword(user) → {Promise.<void>}

Source:
Sends a password reset email for user.
Parameters:
Name Type Description
user the user to send the password reset email for.
Returns:
Type
Promise.<void>

(async, static) searchAuth0Users(search) → {Promise.<Array.<Object>>}

Source:
Searches all the auth0 users with access to this application.
Parameters:
Name Type Description
search string a search query. See https://auth0.com/docs/users/user-search/user-search-query-syntax for the query syntax
Returns:
an array of user objects with only their email, username, and id.
Type
Promise.<Array.<Object>>

(async, static) update(id, update) → {Promise.<boolean>}

Source:
Updates a user object.
Parameters:
Name Type Description
id string the id of the user to update.
update Object an update object (see mongodb documentation for examples).
Returns:
Type
Promise.<boolean>