-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description/Steps to reproduce
I'm having trouble using multiple user models in my app, here is my test case.
I create a new loopback app, follow the doc to add multiple user models, with custom AccesToken model (https://loopback.io/doc/en/lb3/Authentication-authorization-and-permissions.html#access-control-with-multiple-user-models).
I have 5 models:
- BaseUser : that inherit from User and have common functions (not provided in the sample but needed for a DRY code).
- Admin : inherits from BaseUser
- Client: inherits from BaseUser
- CustomAccessToken: inherits from AccessToken
- TaskItem: a persisted model with these ACL
"acls": [ { "accessType": "*", "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY" }, { "accessType": "*", "principalType": "Admin", "principalId": "$everyone", "permission": "ALLOW", "property": "*" }
I want to forbid everyone from accessing the model except Admins.
I tried reversing the order, change principalType to "ROLE" and principalId to "Admin", tried by changing the case (admin, ADMIN, Admin, etc...)
But whatever I do, when accessing the end point GET TaskItems as an Admin user I have a forbidden response.
Of course if I remove all the acls I have the results.
Link to reproduction sandbox
My code is here : https://github.com/abouroubi/loopbacktest
Expected result
Empty Array when Admin and Unauthorized when Client.