Reputation: 315
Sails.js (0.9v) controllers has a *_config function* to override configs from config file.
is there any _policies function to define the policies inside the controllers itself?
Thanks
Upvotes: 1
Views: 775
Reputation: 24948
Policies can already be specified on per-controller basis in the /config/policies.js
file, so there's no benefit in having the configuration exist inside the controller file as well. See the comments inside /config/policies
for information on how to attach a policy to a specific controller or action. Also keep in mind that in Sails v0.10, the _config
key is still valid inside controller files, but the configuration properties should be put at the top level, not under blueprints
, e.g.:
_config: {
rest: false,
actions: false,
shortcuts: false
}
These will override the settings in your /config/blueprints.js
file.
Upvotes: 2
Reputation: 70416
I think nope. You can override the controller config but not create policy inside it. E.g.
...
_config: {
blueprints: {
rest: true, ....
}
}
Please define policies as middleware in the policies folder.
Upvotes: 0