sails-permissions-sequelize
Version:
Sequelize version of : 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.
37 lines (34 loc) • 1.15 kB
JavaScript
/**
* @module Criteria
*
* @description
* Criteria specify limits on a permission, via a 'where' clause and an attribute blacklist.
* For the blacklist, if the request action is update or create, and there is a blacklisted attribute in the request,
* the request will fail. If the request action is read, the blacklisted attributes will be filtered.
* The blacklist is not relevant for delete requests.
* A where clause uses waterline query syntax to determine if a permission is allowed, ie where: { id: { '>': 5 } }
*/
module.exports = {
autoCreatedBy: false,
description: 'Specifies more granular limits on a permission',
attributes: {
where: {
type: Sequelize.JSON
},
blacklist: {
type: Sequelize.ARRAY(Sequelize.TEXT)
},
// permission: {
// model: 'Permission'
// }
},
// associate: function(){
// Criteria.hasMany(Permissions, {as: 'permissions'});
// },
options: {
tableName: 'criteria',
classMethods: {},
instanceMethods: {},
hooks: {}
}
};