Skip to content

Commit 45ed686

Browse files
Even resources with state 'GONE' should be accessible by admins.
1 parent e981376 commit 45ed686

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/edu/kit/datamanager/repo/util/DataResourceUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,12 @@ public static void performPermissionCheck(DataResource resource, PERMISSION requ
478478
LOGGER.trace("Resource state is {}. No special access check necessary.", resource.getState());
479479
break;
480480
case GONE:
481+
// only administrators are allowed to access this resource
482+
if (!AuthenticationHelper.hasAuthority(RepoUserRole.ADMINISTRATOR.toString())) {
481483
String message = "The resource never was or is not longer available.";
482484
LOGGER.info(message);
483485
throw new ResourceNotFoundException(message);
486+
}
484487
default:
485488
LOGGER.warn("Unhandled resource state {} detected. Not applying any special access checks.", resource.getState());
486489
}

0 commit comments

Comments
 (0)