OpenVeo Core server

API Docs for: 7.0.0
Show:

UserController

Extends EntityController
Module: core-controllers

Summary

Defines an entity controller to handle requests relative to users' entities.

Constructor

UserController

Syntax

UserController

()

Summary

Methods

getEntitiesAction

Syntax

getEntitiesAction

(
  • request
  • response
  • next
)

Summary

Gets a list of users.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • [query] Object optional

      Request's query parameters

      • [include] String | Array optional
        The list of fields to include from returned users
      • [exclude] String | Array optional
        The list of fields to exclude from returned users. Ignored if include is also specified.
      • [query] String optional
        Search query to search in user names
      • [useSmartSearch=1] Number optional
        1 to use a more advanced search mechanism, 0 to use a simple search based on a regular expression
      • [page=0] Number optional
        The expected page in pagination system
      • [limit=10] Number optional
        The maximum number of expected results
      • [sortBy="name"] String optional
        The field to sort by (only "name" is available right now)
      • [sortOrder="desc"] String optional
        The sort order (either "asc" or "desc")
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "entities" : [ ... ],
  "pagination" : {
    "limit": ..., // The limit number of users by page
    "page": ..., // The actual page
    "pages": ..., // The total number of pages
    "size": ... // The total number of users
}

getProvider

Syntax

getProvider

() UserProvider

Summary

Gets an instance of the provider associated to the controller.

Returns:

UserProvider:

The provider

updateEntityAction

Syntax

updateEntityAction

(
  • request
  • response
  • next
)

Summary

Updates a user.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request's parameters

      • id String
        Id of the user to update
    • [body] Object optional

      Request's body

      • [name] String optional
        User's name
      • [email] String optional
        User's email
      • [password] String optional
        User's password
      • [passwordValidate] String optional
        User's password validation
      • [roles] Array optional
        User's roles
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1
}