title: SailsJS: How to reset your policies in config/policies.js
body: <p>We have a problem with Sails policies.</p>
  
  <p>Our default policy is:</p>
  
  <pre><code>'*': [
  'basicAuth',
  'passport',
  'sessionAuth',
  'ModelPolicy',
  'AuditPolicy',
  'UpdatedByPolicy',
  'OwnerPolicy',
  'OmniPolicy'
  ],
  </code></pre>
  
  <p>But when I start the server is complains about another policy called CriteriaPolicy, which is NEVER referenced in our policies.js</p>
  
  <p>The <code>CriteriaPolicy</code> comes from the Sails module called sails-permission, which we have installed. However we only want to use some of its polices and not all.</p>
  
  <p>So why is Sails not using our app's config/policies.js as the TRUTH. Why does it allow modules to ADD policies, if I dont want them?</p>
  
  <p>How can I force Sails to only adhere to the policies from the app's config/policies.js?</p>
  
  <p>This the error we get:</p>
  
  <p>TypeError: Cannot read property 'length' of undefined
      at /node/ourapp/node_modules/sails-permissions/dist/api/policies/CriteriaPolicy.js:50:12
      at arrayMap (/node/ourapp/node_modules/sails-permissions/node_modules/lodash/index.js:1406:25)
      at Function.map (/node/ourapp/node_modules/sails-permissions/node_modules/lodash/index.js:6710:14)
      at module.exports (/node/ourapp/node_modules/sails-permissions/dist/api/policies/CriteriaPolicy.js:49:96)
      at routeTargetFnWrapper (/node/ourapp/node_modules/sails/lib/router/bind.js:181:5)
      at callbacks (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:164:37)
      at param (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:138:11)
      at param (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:135:11)
      at pass (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:145:5)
      at nextRoute (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:100:7)
      at callbacks (/node/ourapp/node_modules/@sailshq/express/lib/router/index.js:167:11)
      at /node/ourapp/plugins/plugin-ourapp-foundation/api/policies/OmniPolicy.js:184:12
      at /node/ourapp/node_modules/sails/node_modules/async/lib/async.js:52:16
      at done (/node/ourapp/node_modules/sails/node_modules/async/lib/async.js:246:17)
      at /node/ourapp/node_modules/sails/node_modules/async/lib/async.js:44:16
      at /node/ourapp/plugins/plugin-ourapp-foundation/api/policies/OmniPolicy.js:169:14
      at tryCatcher (/node/ourapp/node_modules/waterline/node_modules/bluebird/js/release/util.js:11:23)</p>