Members
(static) getById
Requests the database for a user with given id
- Source:
Methods
(static) create(username, password, updater) → {Promise.<{password: *, updater: *, username: *}>}
Requests the database for a new entry in the table users.
Should throw error if there already exists a user with the same parameters
Parameters:
Name | Type | Description |
---|---|---|
username |
string | name of the user |
password |
string | |
updater |
int | id of the user who created him |
- Source:
Returns:
- Type
- Promise.<{password: *, updater: *, username: *}>
(static) delete(userId) → {Promise.<void>}
This method delete a user by its id, if a user is associated with a role or a list the association will be deleted too
Parameters:
Name | Type | Description |
---|---|---|
userId |
int |
- Source:
Returns:
- Type
- Promise.<void>
(static) get() → {Promise.<*>}
Requests the database for all existing users
- Source:
Returns:
- Type
- Promise.<*>
(static) getByIdp(idp) → {Promise.<(*|undefined)>}
This method internally called on authentication strategies
Parameters:
Name | Type | Description |
---|---|---|
idp |
string | the id of an IDP |
- Source:
Returns:
- Type
- Promise.<(*|undefined)>
(static) getByUsername(username) → {Promise.<{password: *, id: *, username: *}>}
This method gets a specific user information by his username
Parameters:
Name | Type | Description |
---|---|---|
username |
string | name of the user |
- Source:
Returns:
- Type
- Promise.<{password: *, id: *, username: *}>
(static) getByUsernameAndPassword(username, password) → {Promise.<{password: *, id: *, username: *}>}
Requests the database to return user's that match username and password parameters
returns the first user found with such parameters
Parameters:
Name | Type | Description |
---|---|---|
username |
string | name of the user |
password |
string |
- Source:
Returns:
- Type
- Promise.<{password: *, id: *, username: *}>
(static) updatePassword(password, id) → {Promise.<void>}
This method update the password of a user by its id
Parameters:
Name | Type | Description |
---|---|---|
password |
string | |
id |
int |
- Source:
Returns:
- Type
- Promise.<void>
(static) updateUsername(username, id, updater) → {Promise.<void>}
This method updates the username of a user by its id, the user which is making the update should be sent in the parameter updater
Parameters:
Name | Type | Description |
---|---|---|
username |
string | |
id |
int | |
updater |
int |
- Source:
Returns:
- Type
- Promise.<void>