loopback-component-roles
v1.0.1
Published
Loopback component adding roles management to your User model
Downloads
8
Readme
loopback-component-roles
Component for Loopback, adding roles management to your User model.
More about Loopback components here
## Usage
npm install --save loopback-component-roles
In component-config.json
add
"loopback-component-roles": {
"userModel": "MyUser",
"aclModel": "MyACL",
"roleModel": "MyRole",
"roleMappingModel": "MyRoleMapping",
"adminEmail": "[email protected]"
}
- Where
My*
are the name of your custom models (by default, build-in model will be used). adminEmail
is the mail you want for admin account (by default, [email protected])- All options are optional
Warnings
- If you want to see the method added in the explorer, take care of load the
loopback-component-explorer
afterloopback-component-roles
incomponent-config.json
What does this component do?
- Create a role
admin
if not exist - Create an
admin
user (password by default:admin
) if not exist - Give role
admin
toadmin
user - Create /!\ persisted /!\ ACLs to allow
admin
manipulate roles and users - Add remote methods
addRole
,removeRole
,findByRole
,getAllRoles
,getPersistedRoles
to User model