Comprehensive sails.js user permissions and entitlements system. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
$ npm install @inspire-platform/sails-hook-permissions --save
{
"generators": {
"modules": {
"permissions-api": "@inspire-platform/sails-hook-permissions/generator"
}
}
}
WARNING! The generator is not currently up to date with the 2.x.x releases.
$ sails generate permissions-api
variable | description | default |
---|---|---|
ADMIN_USERNAME |
admin username | admin |
ADMIN_EMAIL |
admin user email address | admin@example.com |
ADMIN_PASSWORD |
admin user password | admin1234 |
...
permissions: {
adminUser: {
username: 'admin',
email: 'admin@example.com',
password: 'admin1234'
// add custom fields here if your model requires them
}
},
...
'*': [
'basicAuth',
'passport',
'sessionAuth',
'ModelPolicy',
'AuditPolicy',
'OwnerPolicy',
'PermissionPolicy',
'RolePolicy',
'CriteriaPolicy'
],
AuthController: {
'*': [ 'passport' ]
}
You can now login using the aforementioned default login data or the admin settings you specified using the /auth/local
endpoint.
{
"identifier": "admin@example.com",
"password": "admin1234"
}
MIT