RoleProvider
Summary
Defines a RoleProvider to get and save back end user roles.
Constructor
RoleProvider
Syntax
RoleProvider
(
-
database
Summary
Parameters:
-
database
DatabaseThe database to interact with
Item Index
Methods
Methods
add
Syntax
add
(
async
-
roles
-
[callback]
Summary
Adds roles.
Parameters:
-
roles
ArrayThe list of roles to store with for each role:
- String name The role name
- Array permissions The role permissions
- String [id] The role id, generated if not specified
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number The total amount of roles inserted
- Array The list of added roles
createIndexes
Syntax
createIndexes
(
async
-
callback
Summary
Creates roles indexes.
Parameters:
-
callback
FunctionFunction to call when it's done with :
- Error An error if something went wrong, null otherwise
remove
Syntax
remove
(
async
-
[filter]
-
[callback]
Summary
Removes roles.
This will execute core hook "ROLES_DELETED" after deleting roles with:
- Array ids The list of deleted role ids
Parameters:
-
[filter]
ResourceFilter optionalRules to filter roles to remove
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number The number of removed roles
updateOne
Syntax
updateOne
(
async
-
[filter]
-
data
-
[callback]
Summary
Updates a role.