Reputation: 63
I have a User model and a User Controller, I am able to create data for the User model. I have other controllers and models to do other things as well.
However, I wanted to stop all access to the other controllers unless authenticated so I tried to put the default policy to stop all access. I then allow public access to the User Controller so that the public can create data for the user Model : signing up.
I get a forbidden message when i tried to create data even though I allowed public access to the create action.
Does anyone know where I am going wrong?
This is is my code for the policy.js
module.exports.policies = {
'*': false,
UserController:
{
create: true,
}}
Cheers
Upvotes: 0
Views: 136
Reputation: 1971
I assume you have two actions defined in UserController; one for showing the create form & one for handling the form submission?
If so, you need to specifically allow access to both of the actions. Sails is rejecting your form submission because you're only allowing access to the action displaying the form but not to the action handling the form POST/GET submission.
Upvotes: 0