Back to Sails

`sails.config.policies`

docs/reference/sails.config/sails.config.policies.md

12.12.20001.4 KB
Original Source

sails.config.policies

<!-- > FUTURE: > > Merge most of the contents of this file into the main reference section on policies. > Include a simple config reference table (with only one row with property: `*`) explaining how > this particular config module is read. But don't worry about trying to explain what policies are here-- instead, link to the full docs on the subject (again, to reduce duplicate content and make this all more maintainable) -->

This configuration is a dictionary that maps policies to an app’s actions. See Concepts > Policies for more info.

Properties

PropertyTypeDefaultDetails
(any string)((string))
or
((dictionary))n/aAny properties added to sails.config.policies will be interpreted as a mapping of policies to a controller or a set of standalone actions.

Example

js
module.exports.policies = {

  '*': 'isLoggedIn', // Require user to be logged in to access any action not otherwise mapped in this config
  'UserController': {
    'login': true    // Always allow access to the user login action
  }


}
<docmeta name="displayName" value="sails.config.policies"> <docmeta name="pageType" value="property">