-
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
Replication + ACLs #1202
Replication + ACLs #1202
Conversation
|
||
test.serverApp = loopback(); | ||
test.serverApp.use(function(req, res, next) { | ||
console.log(req.method, req.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps use debug logs here? require('debug')('test')('%s %s', req.method, req.url)
I don't know enough about our auth&auth implementation to be able to help you. Few things that stand out in the current code:
I don't know how to help you here without debugging your new tests, which is something you can do yourself too.
I am not following you here, what should we check before we start?
Yes, it looks good so far. Few more scenarios to consider:
It may be a good idea to test all three operations in all three scenarios: create, update, delete. On more idea to consider: bulkUpdate should be as atomic as possible. If any of the updates is rejected by auth, then no updates should be applied at all. |
I think the test is passing because the ACL implementation reject anonymous requests when there are ACL configured for the operation, thus I guess this is mostly expected. A more interesting scenario is described in my comment above, where the user is authenticated, but they don't have permissions to create/update/delete the specific model instance. The built-in
I am not sure how exactly the current implementation works, please take the above items with a grain of salt. |
I am more concerned with what exactly led you to create #1166. |
As discussed in chat, I didn't have any specific case where it should not work, just that we didn't have any tests and I had a feeling that a the current implementation of authentication may not work, because:
What I would like to see is a suite of tests that will show that bulkUpdate respects permissions like I described in my comment above, i.e.g that when a user "Joe" can read all Products but cannot modify any of them, then a bulk update will reject a request containing updates of Product instances. When "Employee" record is viewable by all users but only owner can edit it, then a bulk update containing update of different employee than the logged in user will fail. |
Closing in favour of #1270 |
This is a fix for: #1166
Connect to #1166
@bajtos This test already passes. I must be missing something. Are you suggesting that we check before we start replicating?
Also can you comment on the tests I've added. I'd like to ensure I've got those right before I move much further.