-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
findOne ignores $owner dynamic role #238
Comments
Any update on this? Will dynamic role work as specified in the documentation (with "modelId" always available regardless of the method accessed), or will it be reworked with "less" features? |
In order to solve this we need to implement "post-check" for non-destructive operations. You can always use hooks to do whatever access control you want in the meantime. /cc @raymondfeng @bajtos |
Related: #450 |
Is this fixed? or can you post a workaround with hooks? |
I think I found a bug, but I'm not 100% sure if it is my mistake ... according to this line of code https://github.com/strongloop/loopback/blob/master/lib/application.js#L301-L306 I can do something like this: the model has this ACL: someone else can reproduce the error?? sorry my english is verry poor |
This is not really a bug, it's a limitation of how ACL's currently handled (pre- instead of post find). You have a few options when restricting access like this:
|
+1 to this. |
Hello, I am reviewing old issues to check which of them are still relevant. I am little bit confused about what's the actual problem reported here. Could somebody explain 1) what requests to invoke, 2) what is the actual result and 3) was was the expectation? A full app reproducing the problem would be even better, see https://github.com/strongloop/loopback/wiki/Reporting-issues#bug-report |
I have not been developping on loopback for sometimes now, but the initial report is about an inconsistency of the security system when requesting with findOne & findById |
As I was rereading the discussion here, I think the problem is in the fact that LoopBack's ACL system works at method level (a method is allowed or denied) and does not support model-instance restrictions (user X can access only instances 1,2,3 when querying a database). I'm relabelling this issue as |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
Hi,
This is related to #222 and my discussion with @raymondfeng
When using ACL, if you use the role $owner, you cannot access the resource using findOne, but you can using findById.
Here is the definition of the ACLs of "MyModel"
I have activated the "loopback:security:role" debug variable, and this is the trace I get when doing a findById:
As you can see, the modelId is correctly filled.
Now when I run a findOne
No modelId is present this time. This is what breaks the $owner role, and in fact it will break any dynamic role that need to use the current model instance for findOne.
The text was updated successfully, but these errors were encountered: