0.1.7 • Published 9 years ago
loopback-component-role-super v0.1.7
Loopback Component superuser dynamic role
This loopback component add a new dynamic role: admin to become a super user.
You can use the loopback-component-role-user instead of it for more features.
Installation
Install in you loopback project:
npm install --save loopback-component-role-superCreate a component-config.json file in your server folder (if you don't already have one)
Configure options inside
component-config.json:{ "loopback-component-role-super": { "enabled": true, "role": "admin", "models": [] } }
enabledBoolean: whether enable this component. defaults: trueroleString : the role name. defaults: $adminmodelsBoolean|Array of string. defaults: true- enable the admin role to the models.
truemeans all models in the app.models.
- enable the admin role to the models.
isAdminUserFunction(aUserId, aRoleName, callback): the callback function to check whether theaUserIdis an admin user.- the
callbackfunction(err, result) the result should be a boolean. - defaults: the Role should has
aRoleNameand the RoleMapping should has a user withaUserId.
- the
Usage
Just enable it on component-config.json.
set DEBUG=loopback:security:role:super env vaiable to show debug info.