-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permissions ignored in custom User.find #221
Comments
Any chance of some help with this. It's a pretty critical issue if you can't use the UserController without exposing all users to everyone. For reference I'm using v2.2.0 |
Can u paste me your config/policies.js? I am guessing that u did not apply a policies to your UserController and actions. |
This is what I have at the moment
|
Moreso no UserController action is restricted as every action is set to 'true', meaning anybody may hit this controller's actions.
You could be doing something like:
Please have a read of Sails Policies and Sails Blueprint API If I am wrong please correct me :) Improvements and/or new knowledge are always welcome! Hoping to be helpful.. Regards, |
This reason I have the find action on my controller is so I can customise the response. My original post just shows basic example as it doesn't make any difference to the problem. So am I right in thinking Sail permissions only works if you only use the default blueprint routes? |
Not exactly but yes, kind of :) Sails policies only work on controllers and their actions. So u can protect ur find action. But the model logic will not be touched. It basically applies the policies to the blueprint controllers (more correctly ALL controller u mention and configure in policies.js). |
I still a bit confused. If I have the following policies
I can see that the Polices are triggered but just don't have any effect on the results returned. Just seem bizarre that it can go through all the checks only to not have any outcome on the result. Surely that defeats the purpose. |
Also as an experiment I've tried with the Role controller setting policy for read to owner returns no results, and setting it to role does, so policies seem to work sometimes. |
Also my custom findOne for users also returns the correct response i.e users can only view themselves, so it seems it's an issue with just custom find. |
Think this issue might be related to #212
Here the @tjwebb are you able to provide any help with this as little unsure where to look next to find out where it's going wrong. |
see #200 |
OK thanks for letting me know, massively disappointing though. |
We're disappointed as well: balderdashy/sails#3429 (comment) We are looking for active users/contributes to assist in transferring the long-term maintenance responsibility of this project to someone else. |
It is weird. Yesterday I took more than 5 hours reaching for the bug. Permissions seems to be working OK, because until the last policy it reaches only the correct results. But at the end the find request returns everything. I think this could be a problem between sails-permissions and the ORM. I would like to maintain this module, as I use in many projects. |
@medisoft if you're interested in maintaining, can you send me an email? [email protected]. Thanks |
If I put the following in my own UserController permissions seem to be ignored and a user making a request to /user can see all users
If I remove this they only can view their own.
The text was updated successfully, but these errors were encountered: