1

Is it possible to use req.options.where with associations that are more then one level?

If so how?

If not, what is the 'correct way' to go about creating a policy for the following scenario.

I have 3 models User Parent Child

I have the vanilla blueprint actions for all the models.

Children have parents and parents have users.

In my policy I would like to add to the request; the instructions to only return Children of a particular user.

Hopefully it will be similar to the following:

For a Parent request

req.options.where.user = req.session.current_user_id

I am not using 'populate where' functionality of blueprint for this scenario.

Presently, when some one hits the child find action, it displays all the children. I am trying to just allow them to see children of the logged in user.

Any help would be greatly appreciated.

Zdenek
  • 3,653
  • 27
  • 34
user2517182
  • 1,241
  • 3
  • 15
  • 37
  • No it's not possible at the moment. Please take a look at http://stackoverflow.com/questions/23446484/sails-js-populate-nested-associations?rq=1 for more informations about populating nested associations – Yann Bertrand Aug 26 '15 at 08:00
  • @YannBertrand, thanks! This is pretty disappointing though. I took a look at the link, and while informative, I am not sure how this helps me with the policy or sending along the req.option in my policy. – user2517182 Aug 26 '15 at 12:51

0 Answers0