@inspire-platform/sails-hook-permissions
Version:
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.
48 lines (47 loc) • 856 B
JavaScript
/**
* @module Feature
*
* @description
* Simple tag style permissions.
* These are useful for situations when there is a need to create ad hoc policies unrelated to models.
*/
'use strict';
module.exports = {
autoCreatedBy: false,
attributes: {
id: {
type: 'number',
autoIncrement: true
},
name: {
type: 'string',
required: true,
unique: true,
minLength: 1
},
identity: {
type: 'string',
required: true,
unique: true,
minLength: 1
},
context: {
type: 'string',
required: false,
minLength: 1,
defaultsTo: 'default'
},
active: {
type: 'boolean',
defaultsTo: true
},
roles: {
collection: 'Role',
via: 'features'
},
users: {
collection: 'User',
via: 'features'
}
}
};