feat: let APIs return more info about role assignments
What this PR does / why we need it:
This PR updates all API endpoints that return information about role assignments (such as /api/dataverses/$ID/assignments and /api/datasets/$ID/assignments) to include additional fields in their JSON responses: assigneeName, roleDescription, definitionPointName, definitionPointType, and definitionPointGlobalId (if available).
We use this in our custom UI to display the list of assigned roles, similar to this Dataverse UI page:
The extended API responses should also be helpful for the SPA.
Which issue(s) this PR closes:
Not aware of any issue
Special notes for your reviewer:
/
Suggestions on how to test this:
Use API that returns information about role assignments, e.g. curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "localhost:8080/api/dataverses/root/assignments", and see the extended JSON response.
Example response for a dataset (corresponds to UI screenshot above):
{
"status":"OK",
"data":[
{
"id":32067,
"assigneeId":"@testuser",
"assigneeName":"Test User",
"roleId":6,
"roleName":"Contributor",
"roleDescription":"For datasets, a person who can edit License + Terms, and then submit them for review.",
"_roleAlias":"contributor",
"definitionPointId":48080,
"definitionPointName":"Test title",
"definitionPointType":"Dataset",
"definitionPointGlobalId":"perma:testpid-30378"
},
{
"id":2,
"assigneeId":"@dataverseAdmin",
"assigneeName":"Dataverse Admin",
"roleId":1,
"roleName":"Admin",
"roleDescription":"A person who has all permissions for dataverses, datasets, and files, including approving requests for restricted data.",
"_roleAlias":"admin",
"definitionPointId":2,
"definitionPointName":"NFDI4Health",
"definitionPointType":"Dataverse"
},
{
"id":4,
"assigneeId":":authenticated-users",
"assigneeName":"Anyone with a Dataverse account",
"roleId":5,
"roleName":"Dataset Creator",
"roleDescription":"A person who can add datasets within a dataverse.",
"_roleAlias":"dsContributor",
"definitionPointId":2,
"definitionPointName":"NFDI4Health",
"definitionPointType":"Dataverse"
},
{
"id":1679,
"assigneeId":"&explicit/2-curators",
"assigneeName":"Curators",
"roleId":7,
"roleName":"Curator",
"roleDescription":"For datasets, a person who can edit License + Terms, edit Permissions, and publish and link datasets.",
"_roleAlias":"curator",
"definitionPointId":2,
"definitionPointName":"NFDI4Health",
"definitionPointType":"Dataverse"
}
]
}
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 included a release note
Additional documentation:
/
cc @johannes-darms
coverage: 23.515% (+0.009%) from 23.506% when pulling ae5a7abdbe200662c0b834b7026debc2e472fe30 on vera:feat/list-assignments-more-info into a696b3647ad86546f0650279ccac2d976ab202f2 on IQSS:develop.
@vera Please address the conflicts
@vera Please address the conflicts
Done!