DataverseNO - Dataset/Dataverse manage permissions fix - #12503
Conversation
| <!-- Edit Dataset --> | ||
| <div class="btn-group btn-group-justified" jsf:rendered="#{sessionUserAuthenticated | ||
| and canUpdateDataset}"> | ||
| and (canUpdateDataset or canManageDatasetPermissions or canManageFilesOnDataset)}"> |
There was a problem hiding this comment.
This is the start of the menu, which now shows if you can update or manage dataset/file perms.
| </p:commandLink> | ||
| </li> | ||
| <ui:fragment rendered="#{permissionsWrapper.canManagePermissions(DatasetPage.dataset) || permissionsWrapper.canManageFilesOnDataset(DatasetPage.dataset)}"> | ||
| <ui:fragment rendered="#{canUpdateDataset}"> |
There was a problem hiding this comment.
The menu items related to updating the dataset now only show with that permission (no changes to the items, just wrapping in the ui:fragment)
| </ui:fragment> | ||
| <!-- Edit Button --> | ||
| <div class="btn-group" jsf:rendered="#{permissionsWrapper.canIssueUpdateDataverseCommand(DataversePage.dataverse)}"> | ||
| <div class="btn-group" jsf:rendered="#{dataverseSession.user.authenticated and |
There was a problem hiding this comment.
start of menu - added auth user check and then the manageperms option
| </h:link> | ||
| </li> | ||
| <ui:fragment rendered="#{permissionsWrapper.canManagePermissions(DataversePage.dataverse)}"> | ||
| <ui:fragment |
There was a problem hiding this comment.
Same as for dataset.xhtml - new ui:fragments to decide when to render and no changes to the items themselves.
| @@ -0,0 +1 @@ | |||
| Users without permission to edit a dataset or dataverse were not able to access the permission and group management pages via the dataset/dataverse page menus even if they had the relevant ManagePermissions permission. See #3981 and #12218 for details. No newline at end of file | |||
There was a problem hiding this comment.
Do we want to pitch this as a feature? Do we want to encourage adding the custom role that @philippconzett has added?
…ermEditOnly # Conflicts: # src/main/webapp/dataverse.xhtml
| let cite = new Cite(#{workingVersion.getCitation("CSL", true, false)}); | ||
| </script> | ||
| <p:dialog id="cslCitation" header="#{bundle['dataset.cite.cslDialog.title']}" | ||
| widgetVar="cslCitationDialog" dynamic="true" modal="true"> |
There was a problem hiding this comment.
I'm just putting this at the bottom.
Automated JSF tests are failing.
@qqmyers can you please investigate?
Clarified the conditions under which users can manage permissions without edit rights, specifying the interface changes for Dataverse and Dataset pages.
pdurbin
left a comment
There was a problem hiding this comment.
I didn't test this but the changes make sense to me and all tests, including JSF tests are now passing. Approved.
@qqmyers if you're willing to provide a custom role or two in the "how to test" section, it would ease testing. Concrete examples, that is.
My understanding of this PR is that there should be no difference in behavior if custom roles are not used.
What this PR does / why we need it: As discussed in #3981 and #12218, the dataset and dataverse pages in the JSF UI only show the Edit menu when the user has the relevant edit permission. However, the menus contains items to allow editing permissions and groups which require only the relevant manage permissions permission to use. Due to this, users in custom roles who could manage permissions but not edit the dataset/dataverse could only update permissions via API or navigating to the relevant permissions page manually.
This PR adjusts the logic to show the Edit Menu itself whenever any of the list items in it would be allowed (and then includes/omits the relevant items based on the permissions the user has.
Which issue(s) this PR closes:
Special notes for your reviewer:
For the Dataverse page, this also adds a check to see if the user is authenticated before checking their permissions to edit/manage. That's done for other menus and for datasets already - hopefully a minor perf boost.
The bulk of the single line changes are just use of the (mostly) pre-existing ui:params that were not yet being used everywhere. This PR makes changes such as
DataversePage.dataset->dataseteverywhere. If needed, this could be a separate PR, but hopefully AI can do a sanity check on those and any human reviewer can just focus on the changes to the edit menu. I'll mark where those start with comments.Suggestions on how to test this: Regression, plus create a role that has only the Manage<Dataverse, Dataset, File>Permission permission and not the corresponding Edit<Dataverse, Dataset>Permission and verify that the Edit menu shows and only has the Permission/Group entries.
Here's an example that could be used with the https://guides.dataverse.org/en/latest/api/native-api.html#create-role API:
Creating/assigning that role at the start, you should be able to see the difference in the UI with the menu appearing after the PR.
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?: inc.
Additional documentation: