Skip to content
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

cadc-vos-server: fix admin permission check #248

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cadc-vos-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 11

group = 'org.opencadc'

version = '2.0.17'
version = '2.0.18'

description = 'OpenCADC VOSpace server'
def git_url = 'https://github.com/opencadc/vos'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ public void doAction() throws Exception {
}

Subject caller = AuthenticationUtil.getCurrentSubject();
if (!voSpaceAuthorizer.hasSingleNodeWritePermission(serverNode, caller)) {
if (serverNode instanceof ContainerNode
&& nodePersistence.isAllocation((ContainerNode) serverNode)
&& Utils.isAdmin(caller, nodePersistence)) {
log.debug("write permission granted to admin " + caller);
pdowler marked this conversation as resolved.
Show resolved Hide resolved
} else if (!voSpaceAuthorizer.hasSingleNodeWritePermission(serverNode, caller)) {
log.debug("write permission denied to " + caller);
throw NodeFault.PermissionDenied.getStatus(Utils.getPath(serverNode));
}

Expand All @@ -141,7 +146,9 @@ public void doAction() throws Exception {

public static Node updateProperties(Node serverNode, Node clientNode, NodePersistence nodePersistence, Subject caller)
throws Exception {
// merge change request
// merge properties that are Node fields and in Node.properties set
// TODO: admin could in principle change owner

if (clientNode.clearReadOnlyGroups || !clientNode.getReadOnlyGroup().isEmpty()) {
serverNode.getReadOnlyGroup().clear();
serverNode.getReadOnlyGroup().addAll(clientNode.getReadOnlyGroup());
Expand Down
Loading