'use strict'; var actionUtil = require('sails/lib/hooks/blueprints/actionUtil'); /** * todo * * @param {Request} request Request object * @param {Response} response Response object * @param {Function} next Callback function * * @returns {*} */ module.exports = function(request, response, next) { sails.log.verbose(' POLICY - ' + __filename); // Parse where criteria var where = actionUtil.parseCriteria(request); // We have id condition set so we need to check if that / those are allowed if (where.id) { console.log('ID found'); where.id = 2; } else { // Otherwise just add id collection to where query console.log('ID not found'); where.id = 1; } request.query = where; return next(); };