- Source:
Defines an interface for database management classes to implement/inherit from.
Methods
(async, static) addPermissions(id, permission_names, otherUserId, user, checkPermissions) → {Promise.<void>}
- Source:
Adds a list of permissions to a user, possibly checking the permissions of the requesting user to do so
Parameters:
Name | Type | Default | Description |
---|---|---|---|
id |
string | the id of the object to change permissions for | |
permission_names |
Array.<string> | an array of permission names to add to the user | |
otherUserId |
string | the id of the user to add the permissions for | |
user |
Object | the user requesting the permissions be added (for checking their permissions) | |
checkPermissions |
bool |
true
|
a boolean describing whether the permissions of user allow them to add permissions. Defaults to true. |
Returns:
- Type
- Promise.<void>
(async, static) checkPermissions(id, permission_names, user) → {Promise.<boolean>}
- Source:
Checks if a user has a set of permissions to an object in the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the database id of the object to check permissions for |
permission_names |
Array.<string> | An array of permission names to look for |
user |
Object | the user to check permissions for |
Returns:
- Type
- Promise.<boolean>
(async, static) getCollection(name) → {Object}
- Source:
Get a collection from the Loom database. Override this method in children classes to retrieve the specific collection(s) they operate on.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the collection. |
Returns:
- Type
- Object
(async, static) getDatabase() → {Object}
- Source:
Retrieves the Loom database to work with.
Returns:
- Type
- Object
(async, static) hasAnyPermissions(id, user_id) → {Promise.<boolean>}
- Source:
Checks if a user has any permissions to an object in the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id of the object in the database |
user_id |
string | the id of the user to check has permissions |
Returns:
- Type
- Promise.<boolean>
(async, static) removePermissions(id, permission_names, otherUserId, user, checkPermissions) → {Promise.<void>}
- Source:
Removes a list of permissions from a user, possibly checking the permissions of the requesting user to do so
Parameters:
Name | Type | Default | Description |
---|---|---|---|
id |
string | the id of the object to change permissions for | |
permission_names |
Array.<string> | an array of permission names to remove from the user | |
otherUserId |
string | the id of the user to remove the permissions from | |
user |
Object | the user requesting the permissions be removed (for checking their permissions) | |
checkPermissions |
bool |
true
|
a boolean describing whether the permissions of user allow them to remove permissions. Defaults to true. |
Returns:
- Type
- Promise.<void>