退房风帆必须。
// in config/policies.js
var must = require('sails-must')();
module.exports = {
//..
RabbitController: {
nurture: must().be.a('rabbit').mother,
feed: [must().be.nice.to('rabbits'), must().have('rabbit').food]
},
DogController: {
nurture: must().be.a('dog').mother,
feed: [must().be.nice.to('dogs'), must().have('dog').food]
}
//..
//..
SomeController: {
someAction: must().be.able.to('read', 'someModel'),
someOtherAction: must().be.able.to('write', 'someOtherModel').or.be.a.member.of('admins'),
someComplexAction: must().be.able.to(['write', 'publish'], 'someDifferentModel')
}
//..
//..
ProjectController: {
sales: must().be.a.member.of('sales').or.a.member.of('underwriting'),
secret: must().not.be.a.member.of('hr')
}
//..
//..
MovieController: {
adults: must().be.at.least(18, 'years').old,
kids: must().be.at.most(17, 'years').old,
teens: [must().be.at.least(13, 'years').old, must().be.at.most(19, 'years').old]
}
//..
};