policies.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Policy Mappings
  3. * (sails.config.policies)
  4. *
  5. * Policies are simple functions which run **before** your controllers.
  6. * You can apply one or more policies to a given controller, or protect
  7. * its actions individually.
  8. *
  9. * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed
  10. * below by its filename, minus the extension, (e.g. "authenticated")
  11. *
  12. * For more information on how policies work, see:
  13. * http://sailsjs.org/#/documentation/concepts/Policies
  14. *
  15. * For more information on configuring policies, check out:
  16. * http://sailsjs.org/#/documentation/reference/sails.config/sails.config.policies.html
  17. */
  18. module.exports.policies = {
  19. /***************************************************************************
  20. * *
  21. * Default policy for all controllers and actions (`true` allows public *
  22. * access) *
  23. * *
  24. ***************************************************************************/
  25. // '*': true,
  26. /***************************************************************************
  27. * *
  28. * Here's an example of mapping some policies to run before a controller *
  29. * and its actions *
  30. * *
  31. ***************************************************************************/
  32. // RabbitController: {
  33. // Apply the `false` policy as the default for all of RabbitController's actions
  34. // (`false` prevents all access, which ensures that nothing bad happens to our rabbits)
  35. // '*': false,
  36. // For the action `nurture`, apply the 'isRabbitMother' policy
  37. // (this overrides `false` above)
  38. // nurture : 'isRabbitMother',
  39. // Apply the `isNiceToAnimals` AND `hasRabbitFood` policies
  40. // before letting any users feed our rabbits
  41. // feed : ['isNiceToAnimals', 'hasRabbitFood']
  42. // }
  43. };