feat: add APIs to list roles a user can assign for a dataset or dataverse#11919
Open
vera wants to merge 7 commits intoIQSS:developfrom
Open
feat: add APIs to list roles a user can assign for a dataset or dataverse#11919vera wants to merge 7 commits intoIQSS:developfrom
vera wants to merge 7 commits intoIQSS:developfrom
Conversation
…asets and dataverses
This was referenced Oct 22, 2025
# Conflicts: # src/main/java/edu/harvard/iq/dataverse/DataverseRoleServiceBean.java # src/main/java/edu/harvard/iq/dataverse/ManagePermissionsPage.java # src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PR adds two API endpoints that list the roles a user is allowed to assign to others for a given dataset or dataverse.
The endpoints return all roles that have no more permissions than the current user. Roles with higher permissions are excluded.
This is needed for our custom UI’s role assignment form, so that users only see roles they are actually allowed to assign. The same endpoints could also be used by the new SPA.
For reference, the current Dataverse UI lists all roles, even those the user cannot assign:
If a user tries to assign a role they are not allowed to assign, they currently see an error message:
With this PR, the UI could also be updated to show only assignable roles, preventing this error, by applying the following change in
ManagePermissionsPage.java:Which issue(s) this PR closes:
Not aware of an issue
Special notes for your reviewer:
/
Suggestions on how to test this:
I've added tests here:
mvn test -Dtest="DataversesIT#testListAssignableRoles"mvn test -Dtest="DatasetsIT#testListAssignableRoles"Does this PR introduce a user interface change? If mockups are available, please link/include them here:
/
Is there a release notes update needed for this change?:
I've added a release note.
Additional documentation:
/
cc @johannes-darms