@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.
45 lines (42 loc) • 762 B
JavaScript
/**
* @module Model
*
* @description
* Abstract representation of a Waterline Model.
*/
let _ = require('lodash');
module.exports = {
autoCreatedBy: false,
description: 'Represents a Waterline collection that a User can create, query, etc.',
attributes: {
id: {
type: 'number',
autoIncrement: true
},
name: {
type: 'string',
required: true,
unique: true,
minLength: 1
},
identity: {
type: 'string',
minLength: 1
},
attributes: {
type: 'json'
},
permissions: {
collection: 'Permission',
via: 'model'
}
},
customToJSON: function () {
return _.pick(this, [
'id',
'name',
'identity',
'permissions'
]);
}
};