set webspace groupid to main user userid

This commit is contained in:
Michael Hoennig 2024-08-30 17:32:50 +02:00
parent ce81c4a0c1
commit f9309451aa
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.MANAGED_WEBSPACE;
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.UNIX_USER; import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.UNIX_USER;
import static net.hostsharing.hsadminng.hs.validation.IntegerProperty.integerProperty;
class HsManagedWebspaceHostingAssetValidator extends HostingAssetEntityValidator { class HsManagedWebspaceHostingAssetValidator extends HostingAssetEntityValidator {
public HsManagedWebspaceHostingAssetValidator() { public HsManagedWebspaceHostingAssetValidator() {
super( super(
MANAGED_WEBSPACE, MANAGED_WEBSPACE,
AlarmContact.isOptional(), AlarmContact.isOptional(),
NO_EXTRA_PROPERTIES); // TODO.impl: groupid missing, should be equal to main user integerProperty("groupid").readOnly()
);
} }
@Override @Override
@ -43,6 +45,7 @@ class HsManagedWebspaceHostingAssetValidator extends HostingAssetEntityValidator
.prepareForSave() .prepareForSave()
.saveUsing(emw::persist) .saveUsing(emw::persist)
.validateContext(); .validateContext();
webspaceAsset.getConfig().put("groupid", unixUserAsset.getConfig().get("userid"));
} }
} }
} }

View File

@ -176,7 +176,9 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
"type": "MANAGED_WEBSPACE", "type": "MANAGED_WEBSPACE",
"identifier": "fir10", "identifier": "fir10",
"caption": "some separate ManagedWebspace HA", "caption": "some separate ManagedWebspace HA",
"config": {} "config": {
"groupid": 1000000
}
} }
""")) """))
.header("Location", matchesRegex("http://localhost:[1-9][0-9]*/api/hs/hosting/assets/[^/]*")) .header("Location", matchesRegex("http://localhost:[1-9][0-9]*/api/hs/hosting/assets/[^/]*"))