diff options
author | Simon Rettberg | 2022-11-07 14:26:39 +0100 |
---|---|---|
committer | Simon Rettberg | 2022-11-07 14:26:39 +0100 |
commit | 23dcd17ff918878d6f0e04e96f39109b24d7fbf4 (patch) | |
tree | e0f076e7e78aa9e00169eac9f93eeed6c399d8ed /dozentenmodulserver | |
parent | [server] Add start/finished log output to recurring maintenance tasks (diff) | |
download | tutor-module-23dcd17ff918878d6f0e04e96f39109b24d7fbf4.tar.gz tutor-module-23dcd17ff918878d6f0e04e96f39109b24d7fbf4.tar.xz tutor-module-23dcd17ff918878d6f0e04e96f39109b24d7fbf4.zip |
[server] Ignore VM size limit for super user
Diffstat (limited to 'dozentenmodulserver')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java index 7763f7fc..f2382d78 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java @@ -113,9 +113,13 @@ public class ServerHandler implements SatelliteServer.Iface { UserInfo user = SessionManager.getOrFail(userToken); if (!FileSystem.waitForStorage()) throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted"); - if (RuntimeConfig.getVmSizeLimit() > 0 && RuntimeConfig.getVmSizeLimit() < fileSize) - throw new TTransferRejectedException("VM HDD size exceeds limit of " + RuntimeConfig.getVmSizeLimit() + " bytes"); + // Basic permission for given base image User.canEditBaseImageOrFail(user, imageBaseId); + // Check optional size limit + if (RuntimeConfig.getVmSizeLimit() > 0 && !User.isSuperUser(user) + && RuntimeConfig.getVmSizeLimit() < fileSize) + throw new TTransferRejectedException( + "VM HDD size exceeds limit of " + RuntimeConfig.getVmSizeLimit() + " bytes"); ImageDetailsRead image; try { image = DbImage.getImageDetails(user, imageBaseId); |