From 8ae270f887233ffdef1f561cbc9d859b30d07505 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 30 Aug 2024 17:32:50 +0200 Subject: [PATCH] set webspace groupid to main user userid --- .../validators/HsManagedWebspaceHostingAssetValidator.java | 5 ++++- .../asset/HsHostingAssetControllerAcceptanceTest.java | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsManagedWebspaceHostingAssetValidator.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsManagedWebspaceHostingAssetValidator.java index ca10ee7c..52a29dc5 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsManagedWebspaceHostingAssetValidator.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsManagedWebspaceHostingAssetValidator.java @@ -8,13 +8,15 @@ import java.util.regex.Pattern; import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.MANAGED_WEBSPACE; import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.UNIX_USER; +import static net.hostsharing.hsadminng.hs.validation.IntegerProperty.integerProperty; class HsManagedWebspaceHostingAssetValidator extends HostingAssetEntityValidator { public HsManagedWebspaceHostingAssetValidator() { super( MANAGED_WEBSPACE, AlarmContact.isOptional(), - NO_EXTRA_PROPERTIES); // TODO.impl: groupid missing, should be equal to main user + integerProperty("groupid").readOnly() + ); } @Override @@ -43,6 +45,7 @@ class HsManagedWebspaceHostingAssetValidator extends HostingAssetEntityValidator .prepareForSave() .saveUsing(emw::persist) .validateContext(); + webspaceAsset.getConfig().put("groupid", unixUserAsset.getConfig().get("userid")); } } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java index 9647166b..c668c6c9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java @@ -176,7 +176,9 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup "type": "MANAGED_WEBSPACE", "identifier": "fir10", "caption": "some separate ManagedWebspace HA", - "config": {} + "config": { + "groupid": 1000000 + } } """)) .header("Location", matchesRegex("http://localhost:[1-9][0-9]*/api/hs/hosting/assets/[^/]*"))