1

Sails js で基本ポリシーを作成しました。

app/config/policies.js で

module.exports.policies = {
   '*': 'sessionAuth'
};

app/api/policies/sessionAuth.js 内

module.exports = function(req, res, next) {
console.log('reach');

  if (req.session.authenticated) {
    return next();
  }


  return res.forbidden('You are not permitted to perform this action.');
};

しかし、いくつかの URL を要求しているときに、「到達」がコンソールに出力されず、この基本的なポリシーが機能していません。route.jsで定義されているコントローラーのアクションに行きます。

4

1 に答える 1