-
Notifications
You must be signed in to change notification settings - Fork 43
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
Policy & include #96
Comments
As per #98 this is because the authorizer/policy authorizes the controller action, not individual parts of the request. However our implementation is flexible enough that you can add this logic if it is needed for your application. For this, either use the |
Like in #98, it's sounds like security issue. What is the point of using policy for relationship when still exists method to skip this? It should be handled by library it self. |
So this is too complex to implement in the way you're proposing. Let's say there's a |
Plus it starts to get even more complex if the client includes |
Yes, it's comples issue. Maybe something like viewAnyName()? and than explode If you don't want to user see some page, you build login page, auhtorization, etc. You don't want the user to be able to enter there by other way. |
Exploding it an calling it for 4 policies would be hideously complex, as the relationships aren't eager-loaded at the point the authorizer is called. Plus you'd have to call the authorization method Not saying what you're trying to do is wrong; just saying it's far too complex for this package to implement. It is however supported, you'd just have to write your own authorizer. This is now all explained in the docs here: |
OK, i'm trying to stick to this behaviour but I ran into another problem: I marked my one of relation as hidden, to prevent accessing this relation via include - it works fine, but now, when i try to access
It also happend when You just try to include any non-existing relationship. I think this should not generate an error (500). How do I hide the relationship from the main resource leaving access via the url? |
I got it, Btw. I still argue that include random string should not throw a exception. |
Random string throws an exception is the correct behaviour. A non-included relationship should be rejected at the validation stage, and result in a I've definitely seen those validation exceptions so not sure why it isn't rejecting on your resource? |
Yes, error 400 will be fine, but i got 500 in that case. Steps to reproduce:
|
Oh no hang on, I didn't fully understand what you were saying. Hidden only hides the field within the resource's JSON. It won't affect the relationship routes... because if you don't want a relationship to be accessible via its route, you just don't register the route. If you are getting a 500 when you are not expecting it, please can you create a separate issue and provide a full stack trace of the exception that is causing the 500? |
Correct.
Yes, of course: #105 Btw. Thanks for your time and responses, the library which you create is great and I really appreciate what you do. In past i create 4 projects based on it and now i trying to learn and use the new version - which is not easy sometimes. So, once again, thanks a lot! :) |
No problem, thanks for the feedback! |
Hi,
For example, i have resource users with patient relation. When i
return false
in user policy in viewPatient method i can't GET /users/id/patient. It's ok.But... i can still do that: GET /users/id?include=patient
Shouldn't this also be forbidden?
The text was updated successfully, but these errors were encountered: