javascript - Sails js policies not working -
i have written basic policies in sails js.
in app/config/policies.js
module.exports.policies = { '*': 'sessionauth' };
in app/api/policies/sessionauth.js
module.exports = function(req, res, next) { console.log('reach'); if (req.session.authenticated) { return next(); } return res.forbidden('you not permitted perform action.'); };
but when requesting url, 'reach' not printing in console , basic policies not working. going controller's action define in route.js.
the problem in policies.js file :
you can try
module.exports.policies = { //your controller usercontroller: { '*': 'sessionauth' } };
Comments
Post a Comment