summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver
diff options
context:
space:
mode:
authorSimon Rettberg2022-11-07 14:26:39 +0100
committerSimon Rettberg2022-11-07 14:26:39 +0100
commit23dcd17ff918878d6f0e04e96f39109b24d7fbf4 (patch)
treee0f076e7e78aa9e00169eac9f93eeed6c399d8ed /dozentenmodulserver
parent[server] Add start/finished log output to recurring maintenance tasks (diff)
downloadtutor-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.java8
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);