@inspire-platform/sails-hook-permissions
v2.0.0-15-hf1
Published
Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
Downloads
59
Readme
@inspire-platform/sails-hook-permissions
Comprehensive sails.js user permissions and entitlements system. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
Contents
- Install
- Quickstart
- Concepts
- Configuration
- Managing Permissions
Install
$ npm install @inspire-platform/sails-hook-permissions --save
Quickstart
1. configure sailsrc
{
"generators": {
"modules": {
"permissions-api": "@inspire-platform/sails-hook-permissions/generator"
}
}
}
2. run generator
WARNING! The generator is not currently up to date with the 2.x.x releases.
$ sails generate permissions-api
3. Manual configuration
Env vars
| variable | description | default |
|:---|:---|:---|
| ADMIN_USERNAME
| admin username | admin
|
| ADMIN_EMAIL
| admin user email address | [email protected]
|
| ADMIN_PASSWORD
| admin user password | admin1234
|
config/permissions.js (or config/local.js)
...
permissions: {
adminUser: {
username: 'admin',
email: '[email protected]',
password: 'admin1234'
// add custom fields here if your model requires them
}
},
...
config/policies.js
'*': [
'basicAuth',
'passport',
'sessionAuth',
'ModelPolicy',
'AuditPolicy',
'OwnerPolicy',
'PermissionPolicy',
'RolePolicy',
'CriteriaPolicy'
],
AuthController: {
'*': [ 'passport' ]
}
4. Login
You can now login using the aforementioned default login data or the admin settings you specified using the /auth/local
endpoint.
{
"identifier": "[email protected]",
"password": "admin1234"
}
License
MIT