1

after a bit of time, I found why my policies were not working.

I have the following file tree:

myProject > api > controllers > v1 > UserController

When i was applying my policy to UserController, nothing would change:

UserController: {
    '*': 'sessionAuth',
}

I then tried moved the UserController under controllers :

myProject > api > controllers > UserController

This worked.

So my questions is the following, can I still have the v1 folder and have policies working? I want to be able to have version folder. The suggestion made here is not really great, prepending all your controller with a version number is a bit redundant to me. Nested Models and controllers in sails are not working Policies

Looking forward to hear your thoughts!

Thanks

Community
  • 1
  • 1
Julian
  • 81
  • 4
  • After looking into it, it seems the only way to do this (sails.js v0.11) is to prepend or append a version number to your controller (eg V1UserController). A dedicated folder will cause issues with policies so this is the best option as far as I know. Not the neatest but will definitely work. – Julian Jan 15 '16 at 03:58

1 Answers1

1

'v1/userController':{ "*":true }

MK4
  • 725
  • 8
  • 24