From 23dcd17ff918878d6f0e04e96f39109b24d7fbf4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 7 Nov 2022 14:26:39 +0100 Subject: [server] Ignore VM size limit for super user --- .../src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | 8 ++++++-- 1 file 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); -- cgit v1.2.3-55-g7522