summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);