Can you turn off some blueprints on a specific controller?

Is there a known way to disable blueprints

each controller- specific one in sails.js

?

I have read how to disable ALL blueprints

at the application level and how to disable ALL blueprints

for an individual controller

, but is there a way to disable a subset blueprints

for an individual user controller

?

This documentation covers the basics, including disabling everyone blueprints

per controller, https://github.com/balderdashy/sails-docs/blob/master/reference/blueprint-api/blueprint-api.md

But tell me, that I have a model Counties

, and I want to perform actions find

( find()

and findOne()

), but not other needs.

Is this an option?

+3


source to share


1 answer


You can override them in controllers. For example,

  update: function (req, res) {
    res.forbidden();
  },  

  destroy: function (req, res) {
    res.forbidden();
  } 

      

This is one way. Another and more preferred way is to use policies:



  myController: {
    'find': true,
    'findOne': true,
    '*': false
  },

      

This will only detect find and findOne and hide other activities.

+6


source







All Articles