-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Role Hierarchy not working #683
Comments
Known issue, the current role logic only supports nesting roles 1-level deep. PRs welcome https://github.com/ParsePlatform/parse-server/blob/master/src/Auth.js#L141 |
@gfosco implemented it in there: https://github.com/flovilmart/__AppStack__/blob/master/controllers/core/RoleController.js do you think that would do recursively? |
Merged #689, this should be fixed in 2.1.4. |
I just updated to the latest release but my superuser is still not able to modify a product. |
@gfosco I just did a test and I think the
Which, according to how I understand the docs means that superuser has same rights as admin. The
If I now just manually switch the IDs in my DB to
everything is working as expected. This would also explains #827 because for customer roles I'm doing the same:
|
@gfosco THX for the Tests. But for some reasons the issue still appears and is NOT covered by the tests. To better illustrate the issue, I adjusted the Spec to exactly cover my Case:
Running this test works just fine - NO ERRORS. The I take almost the exact same code and put it into cloud function:
And for some reasons, this Cloud function fails with the attempt of the Super User to update the Product... As mentioned in my comment above, I could manually fixed the issue by just switching the IDs of the 2 role relations in the |
@flavordaaave you should not switch manually the ids :) what version are you running? master, 2.4? because there was a problem in the recursive roles resolution where the query was looking for $relatedTo instead of "users" which is what you describe as switching the ID's. The fix was introduce with #841 |
@flovilmart I know that manually switching the IDs is not a solution, I just recognized that those IDs seem to be the reason ;) According to serverInfo I'm running |
@flovilmart THX again. I just tested with the latest master branch and everything is working now!!! 👍 👍 👍 |
Thanks for your debugging! That put me on the right direction! |
I just did some dirty tests where I have a Cloud Function that initially does following:
(For testing purposes I have all this wrapped into this ugly spaghetti code
I also have a Class of Product and a beforeSave Hook that adds
setPublicReadAccess(true);
and
productACL.setRoleWriteAccess("admin", true);
to each product that is saved.
In my DB it seems that everything is setup properly:
Product:
_User
Role
and
_Join:roles:_Role
_Join:users:_Role
When I now login as this superuser, I can't update a Product even though the superuser role is a child of admin and should have ALL the admin rights which include write permission to Product.
(According to this doc https://parse.com/docs/js/guide#roles-role-hierarchy)
The text was updated successfully, but these errors were encountered: