TDL/Power User Permission/Role - #12676
Open
qqmyers wants to merge 12 commits into
Open
Conversation
Summary • Implemented the first stage of the Scoped Power Admin feature. • Added a new ScopedPowerAdmin permission and a PowerAdmin role alias. • Created isPowerUser functionality and integrated it into the setStorageDriver API call. Changes • Modified Permission.java to include the ScopedPowerAdmin permission. • Updated DataverseRole.java with a new POWER_ADMIN role constant. • Added isPowerUser(AuthenticatedUser user, DvObject dvo) to PermissionServiceBean.java to check for superuser status or the new permission. • Updated the setStorageDriver method in Dataverses.java to use permissionSvc.isPowerUser instead of a hardcoded isSuperuser check. • Added localized strings for the new permission and role in Bundle.properties and BuiltInRoles.properties.
# Conflicts: # src/main/java/edu/harvard/iq/dataverse/DataversePage.java # src/main/java/edu/harvard/iq/dataverse/PermissionsWrapper.java # src/main/java/edu/harvard/iq/dataverse/api/Access.java # src/main/java/edu/harvard/iq/dataverse/api/Datasets.java # src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java # src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDataverseLinkingDataverseCommand.java # src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDataverseCommand.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: As discussed in #10588, multi-institution Dataverse instances (and possibly others) would like to delegate some functionality that is normally restricted to superusers to users managing specific collections/datasets/files, e.g. for a given institution.
This PR addresses some of that, creating a new ScopedPowerUser permission and Power User role that includes it. Someone who is assigned this role (or a custom role with this permission) for a given collection/dataset/file is allowed to use any functionality previously restricted to superusers that is directly associated with that collection, dataset, or file, i.e. to change the file store used, PID provider, etc.
The PR does not address superuser functionality that is global, e.g. managing users, configuring Harvesting Servers, etc.
Which issue(s) this PR closes:
Special notes for your reviewer: This is a relatively large PR due to the breadth of functionality involved, but the main design is simple - calls to check if a user isSuperuser() are replaced with checks for is PowerUser(user, dvobject) that first checks if the user is a superuser and, if not, checks to see if they have an assignment that gives them the ScopedPowerUser permission on the dvobject specified. That pattern repeats across many api calls and commands, etc.
The ScopedPowerUser permission and "Power User" role names can be changed if there are better options. The issue suggests Institutional Admin as the role, but Institutional seems limited to that specific use case. The role is currently defined as a built-in role (e.g. with a flyway script to add it) but it could nominally be a custom role if there are concerns (so no role would have the ScopedPowerUser permission out-of-the-box.
Suggestions on how to test this: The unit tests included check the underlying changes to isPowerUser() and related methods which are used repeatedly, To check at the API/UI level, run any superuser functionality as a superuser, someone assigned the new role, or a normal user and confirm that superusers and only Power Users with an assignment on the given dvobject (or parent) succeed.
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?:
Additional documentation: