-
Notifications
You must be signed in to change notification settings - Fork 500
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
return more perms from /api/access/datafile/{id}/userPermissions #11267
base: develop
Are you sure you want to change the base?
Conversation
@@ -1711,6 +1711,10 @@ public Response getUserPermissionsOnFile(@Context ContainerRequestContext crc, @ | |||
jsonObjectBuilder.add("canDownloadFile", permissionService.userOn(requestUser, dataFile).has(Permission.DownloadFile)); | |||
jsonObjectBuilder.add("canManageFilePermissions", permissionService.userOn(requestUser, dataFile).has(Permission.ManageFilePermissions)); | |||
jsonObjectBuilder.add("canEditOwnerDataset", permissionService.userOn(requestUser, dataFile.getOwner()).has(Permission.EditDataset)); | |||
jsonObjectBuilder.add("canEditFileMetadata", permissionService.userOn(requestUser, dataFile.getOwner()).has(Permission.EditDataset)); |
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.
So the code returns the answer to Permission.EditDataset 5 times in a row?
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.
This comment has been minimized.
This comment has been minimized.
1 similar comment
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
What this PR does / why we need it:
API users (especially the frontend team, which is writing the new UI) need more granularity when checking file permissions.
Which issue(s) this PR closes:
Special notes for your reviewer:
Instead of adding these four new permissions, the API user could simply check the existing "canEditOwnerDataset" instead. I'm curious where these permissions come from? JSF? They aren't in our main Permission class.
I cleaned up existing assertions and added a new "no perms" user and additional assertions.
Suggestions on how to test this:
Create some users. Give them various permissions. Check the
/api/access/datafile/{id}/userPermissions
API. Does it return the right results?Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No.
Is there a release notes update needed for this change?:
Additional documentation: