Merge remote-tracking branch 'origin/master'

This commit is contained in:
Axel Uhl
2023-05-27 09:35:49 +02:00
6 changed files with 24 additions and 3 deletions
@@ -435,9 +435,6 @@ public enum DetailType implements Serializable {
allowed.add(OVERALL_TIME_ON_TIME_FACTOR);
allowed.add(OVERALL_TIME_ON_DISTANCE_ALLOWANCE_IN_SECONDS_PER_NAUTICAL_MILE);
allowed.add(OVERALL_TOTAL_SCORED_RACE_COUNT);
allowed.add(TOTAL_TIME_SAILED_UPWIND_IN_SECONDS);
allowed.add(TOTAL_TIME_SAILED_REACHING_IN_SECONDS);
allowed.add(TOTAL_TIME_SAILED_DOWNWIND_IN_SECONDS);
return allowed;
}
@@ -47,6 +47,8 @@ import com.sap.sse.landscape.aws.AwsLandscape;
import com.sap.sse.landscape.aws.MongoUriParser;
import com.sap.sse.landscape.aws.impl.AwsRegion;
import com.sap.sse.landscape.mongodb.MongoEndpoint;
import com.sap.sse.security.shared.TypeRelativeObjectIdentifier;
import com.sap.sse.security.shared.impl.SecuredSecurityTypes;
import software.amazon.awssdk.services.ec2.model.InstanceType;
@@ -248,6 +250,10 @@ public class SailingLandscapeResource extends AbstractLandscapeResource {
@FormParam(REMOVE_APPLICATION_REPLICA_SET_FORM_PARAM) @DefaultValue("true") boolean removeApplicationReplicaSet,
@FormParam(MONGO_URI_TO_ARCHIVE_DB_TO_FORM_PARAM) String mongoUriToArchiveDbTo) {
checkLandscapeManageAwsPermission();
if (removeApplicationReplicaSet) {
getSecurityService().checkCurrentUserDeletePermission(SecuredSecurityTypes.SERVER.getQualifiedObjectIdentifier(
new TypeRelativeObjectIdentifier(replicaSetName)));
}
Response response;
final AwsRegion region = new AwsRegion(regionId, getLandscapeService().getLandscape());
byte[] passphraseForPrivateKeyDecryption = privateKeyEncryptionPassphrase==null?null:privateKeyEncryptionPassphrase.getBytes();
@@ -334,6 +340,8 @@ public class SailingLandscapeResource extends AbstractLandscapeResource {
@FormParam(PRIVATE_KEY_ENCRYPTION_PASSPHRASE_FORM_PARAM) String privateKeyEncryptionPassphrase,
@FormParam(MONGO_URI_TO_ARCHIVE_DB_TO_FORM_PARAM) String mongoUriToArchiveDbTo) {
checkLandscapeManageAwsPermission();
getSecurityService().checkCurrentUserDeletePermission(SecuredSecurityTypes.SERVER.getQualifiedObjectIdentifier(
new TypeRelativeObjectIdentifier(replicaSetName)));
Response response;
final AwsRegion region = new AwsRegion(regionId, getLandscapeService().getLandscape());
byte[] passphraseForPrivateKeyDecryption = privateKeyEncryptionPassphrase==null?null:privateKeyEncryptionPassphrase.getBytes();
@@ -102,6 +102,7 @@ import com.sap.sse.replication.FullyInitializedReplicableTracker;
import com.sap.sse.security.SecurityService;
import com.sap.sse.security.SessionUtils;
import com.sap.sse.security.shared.HasPermissions.DefaultActions;
import com.sap.sse.security.shared.impl.SecuredSecurityTypes;
import com.sap.sse.security.shared.TypeRelativeObjectIdentifier;
import com.sap.sse.security.ui.server.SecurityDTOUtil;
import com.sap.sse.util.ServiceTrackerFactory;
@@ -624,6 +625,10 @@ public class LandscapeManagementWriteServiceImpl extends ResultCachingProxiedRem
String optionalKeyName, byte[] passphraseForPrivateKeyDecryption)
throws Exception {
checkLandscapeManageAwsPermission();
if (removeApplicationReplicaSet) {
getSecurityService().checkCurrentUserDeletePermission(SecuredSecurityTypes.SERVER.getQualifiedObjectIdentifier(
new TypeRelativeObjectIdentifier(applicationReplicaSetToArchive.getReplicaSetName())));
}
final Pair<DataImportProgress, CompareServersResult> result = getLandscapeService().archiveReplicaSet(regionId,
convertFromApplicationReplicaSetDTO(new AwsRegion(regionId, getLandscape()), applicationReplicaSetToArchive),
bearerTokenOrNullForApplicationReplicaSetToArchive, bearerTokenOrNullForArchive,
@@ -649,6 +654,8 @@ public class LandscapeManagementWriteServiceImpl extends ResultCachingProxiedRem
String optionalKeyName, byte[] passphraseForPrivateKeyDecryption)
throws Exception {
checkLandscapeManageAwsPermission();
getSecurityService().checkCurrentUserDeletePermission(SecuredSecurityTypes.SERVER.getQualifiedObjectIdentifier(
new TypeRelativeObjectIdentifier(applicationReplicaSetToRemove.getReplicaSetName())));
getLandscapeService().removeApplicationReplicaSet(regionId, convertFromApplicationReplicaSetDTO(
new AwsRegion(regionId, getLandscape()), applicationReplicaSetToRemove), null, optionalKeyName, passphraseForPrivateKeyDecryption);
return null;
@@ -35,6 +35,9 @@ public class SailingApplicationReplicaSetDTO<ShardingKey> implements Named, IsSe
Util.addAll(replicas, this.replicas);
}
/**
* Same as {@link #getReplicaSetName()}, adapting to the {@link Named} interface
*/
public String getName() {
return getReplicaSetName();
}
@@ -609,6 +609,8 @@ public class LandscapeServiceImpl implements LandscapeService {
} else {
logger.info("No archiving of database content was requested. Leaving "+fromDatabase.getConnectionURI()+" untouched.");
}
getSecurityService().deleteAllDataForRemovedObject(SecuredSecurityTypes.SERVER.getQualifiedObjectIdentifier(
new TypeRelativeObjectIdentifier(applicationReplicaSet.getServerName())));
}
private boolean isAllAutoScalingReplicasShutDown(
@@ -434,6 +434,10 @@ public interface SecurityService extends ReplicableWithObjectInputStream<Replica
<T> T checkPermissionAndDeleteOwnershipForObjectRemoval(WithQualifiedObjectIdentifier object,
Callable<T> actionToDeleteObject);
/**
* Deletes {@link #deleteOwnership(QualifiedObjectIdentifier) ownership} and
* {@link #deleteAccessControlList(QualifiedObjectIdentifier) ACLs} for the object identified by {@code identifier}
*/
void deleteAllDataForRemovedObject(QualifiedObjectIdentifier identifier);
<T extends WithQualifiedObjectIdentifier> void filterObjectsWithPermissionForCurrentUser(