set webspace groupid to main user userid

This commit is contained in:
Michael Hoennig 2024-08-30 17:32:50 +02:00
parent 0f070ab8bb
commit 8ae270f887
2 changed files with 7 additions and 2 deletions

View File

@ -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"));
}
}
}

View File

@ -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/[^/]*"))