UNPKG

@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.

41 lines (38 loc) 758 B
/** * @module Model * * @description * Abstract representation of a Waterline Model. */ 'use strict'; var _ = 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 customToJSON() { return _.pick(this, ['id', 'name', 'identity', 'permissions']); } };