OpenVeo Core server

API Docs for: 7.0.0
Show:

UserProvider

Extends EntityProvider
Module: core-providers

Summary

Defines a UserProvider to get and save back end users.

Constructor

UserProvider

Syntax

UserProvider

(
  • database
)

Summary

Parameters:

  • database Database

    The database to interact with

Methods

add

Syntax

add

(
  • users
  • [callback]
)
async

Summary

Adds users.

Parameters:

  • users Array

    The list of users to store with for each user:

    • String name The user name
    • String email The user email
    • String password The user password
    • String passwordValidate The user password validation
    • String [id] The user id, generated if not specified
    • Array [roles] The user role ids
    • Boolean [locked=false] true to lock the user from edition, false otherwise
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The total amount of users inserted
    • Array The list of added users

addThirdPartyUsers

Syntax

addThirdPartyUsers

(
  • users
  • [callback]
)
async

Summary

Adds external users.

External users are automatically locked when added.

Parameters:

  • users Array

    The list of users to add with for each user:

    • String name The user name
    • String email The user email
    • String origin Id of the third party provider system
    • String originId The user id in third party provider system
    • String [id] The user id, generated if not specified
    • Array [originGroups] The user groups in third party provider system
    • Array [roles] The user role ids
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The total amount of users inserted
    • Array The inserted users

createIndexes

Syntax

createIndexes

(
  • callback
)
async

Summary

Creates users indexes.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

getUserByCredentials

Syntax

getUserByCredentials

(
  • email
  • password
  • callback
)
async

Summary

Gets an internal user by its credentials.

Parameters:

  • email String

    The user email

  • password String

    The user clear text password

  • callback Function

    Function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Object The user

getUserByEmail

Syntax

getUserByEmail

(
  • email
  • callback
)
async

Summary

Gets an internal user by its email.

Parameters:

  • email String

    The email of the user

  • callback Function

    Function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Object The user

remove

Syntax

remove

(
  • [filter]
  • [callback]
)
async

Summary

Removes users.

This will execute core hook "USERS_DELETED" after removing users with:

  • Array The ids of deleted users

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter users to remove

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of removed users

updateOne

Syntax

updateOne

(
  • [filter]
  • data
  • [callback]
)
async

Summary

Updates an internal user.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the user to update

  • data Object

    The modifications to perform

    • [name] String optional

      The user name

    • [email] String optional

      The user email

    • [password] String optional

      The user password. Also requires passwordValidate

    • [passwordValidate] String optional

      The user password validation. Also requires password

    • [roles] Array optional

      The user role ids

    • [locked] Boolean optional

      true to lock the user from edition, false otherwise

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine

updateThirdPartyUser

Syntax

updateThirdPartyUser

(
  • [filter]
  • data
  • origin
  • callback
)
async

Summary

Updates an external user.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter users to update

  • data Object

    The modifications to perform

    • [name] String optional

      The user name

    • [email] String optional

      The user email

    • [originGroups] Array optional

      The user groups in third party provider system

    • [roles] Array optional

      The user role ids

    • [locked] Boolean optional

      true to lock the user from edition, false otherwise

  • origin String

    The user origin (see openVeoApi.passport.STRATEGIES)

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine