Methods
(static) changeActiveFlag(UserId, RoleId, newState) → {Promise.<void>}
Changes the active bit of the association between the user UserId and the role RoleId, according to the provided newState
Parameters:
Name | Type | Description |
---|---|---|
UserId |
int | |
RoleId |
int | |
newState |
int |
- Source:
Returns:
- Type
- Promise.<void>
(static) create(user, role, startDate, end_date, updater, active) → {Promise.<void>}
Associate a user with a role, the parameters user and role represent the user id and the role id, the endDate determines when the association between
that role and that user will expire and the active bit will turn into 0.
Parameters:
Name | Type | Description |
---|---|---|
user |
int | |
role |
int | |
startDate |
Date | |
end_date |
Date | |
updater |
int | |
active |
int |
- Source:
Returns:
- Type
- Promise.<void>
(static) delete(UserId, RoleId) → {Promise.<{deletedRows: Promise.<(Object|Error)>}>}
Deletes the association between the user with UserId and the role with RoleId.
Parameters:
Name | Type | Description |
---|---|---|
UserId |
int | |
RoleId |
int |
- Source:
Returns:
- Type
- Promise.<{deletedRows: Promise.<(Object|Error)>}>
(static) get() → {Promise.<void>}
Returns all the associations
- Source:
Returns:
- Type
- Promise.<void>
(static) getActive() → {Promise.<*>}
Returns all the associations that have the active bit to 1
- Source:
Returns:
- Type
- Promise.<*>
(static) getById(id) → {Promise.<void>}
Return a specific association by its id
Parameters:
Name | Type | Description |
---|---|---|
id |
int |
- Source:
Returns:
- Type
- Promise.<void>
(static) getByRole(RoleId) → {Promise.<(Object|Error)>}
Return all associations between user and role of the role with the id=roleId.
Parameters:
Name | Type | Description |
---|---|---|
RoleId |
int |
- Source:
Returns:
- Type
- Promise.<(Object|Error)>
(static) getByUser(userId) → {Promise.<(Object|Error)>}
Return all associations between user and role of the user with the id=userId.
Parameters:
Name | Type | Description |
---|---|---|
userId |
int |
- Source:
Returns:
- Type
- Promise.<(Object|Error)>
(static) getUserActiveRoles(id) → {Promise.<*>}
Returns all the associations that have the active bit to 1 of a specific user
Parameters:
Name | Type | Description |
---|---|---|
id |
int |
- Source:
Returns:
- Type
- Promise.<*>
(static) update(user, role, start_date, end_date, active, updater) → {Promise.<{end_date: *, active: *, updatedRows: (Object|Error), updater: *}>}
Changes the start_date, endDate, active and updater of the association between the user with id=user and the role with id=role.
Parameters:
Name | Type | Description |
---|---|---|
user |
int | |
role |
int | |
start_date |
Date | |
end_date |
Date | |
active |
int | |
updater |
int |
- Source:
Returns:
- Type
- Promise.<{end_date: *, active: *, updatedRows: (Object|Error), updater: *}>