merge fixes

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2026-04-09 23:52:05 +05:30
parent 2f673568aa
commit 40cadd0369
7 changed files with 17 additions and 5 deletions

View File

@ -81,7 +81,7 @@ public class CreateImageTransferCmd extends BaseCmd implements AdminCmd {
}
public ImageTransfer.Format getFormat() {
return EnumUtils.fromString(ImageTransfer.Format.class, format);
return EnumUtils.getEnum(ImageTransfer.Format.class, format);
}
@Override

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>4.22.1.0-SNAPSHOT</version>
<version>4.23.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -1447,11 +1447,11 @@ public class ServerAdapter extends ManagerBase {
}
accountService.checkAccess(CallContext.current().getCallingAccount(), null, false,
volumeVO);
Direction direction = EnumUtils.fromString(Direction.class, request.getDirection());
Direction direction = EnumUtils.getEnum(Direction.class, request.getDirection());
if (direction == null) {
throw new InvalidParameterValueException("Invalid or missing direction");
}
Format format = EnumUtils.fromString(Format.class, request.getFormat());
Format format = EnumUtils.getEnum(Format.class, request.getFormat());
Long backupId = null;
if (request.getBackup() != null && StringUtils.isNotBlank(request.getBackup().getId())) {
BackupVO backupVO = backupDao.findByUuid(request.getBackup().getId());

View File

@ -348,7 +348,7 @@ public final class Vm extends BaseDto {
@JsonIgnore
public int getTypeOrdinal() {
Type enumType = EnumUtils.fromString(Type.class, type, Type.q35_sea_bios);
Type enumType = EnumUtils.getEnum(Type.class, type, Type.q35_sea_bios);
return enumType.ordinal();
}

View File

@ -597,6 +597,10 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
public void checkApiAccess(Account account, String command, String apiKey) throws PermissionDeniedException {
}
@Override
public void checkApiAccess(Account caller, String command) throws PermissionDeniedException {
}
@Override
public UserAccount clearUserTwoFactorAuthenticationInSetupStateOnLogin(UserAccount user) {
return null;

View File

@ -204,6 +204,8 @@ public interface AccountManager extends AccountService, Configurable {
void checkApiAccess(Account caller, String command, String apiKey);
void checkApiAccess(Account caller, String command);
UserAccount clearUserTwoFactorAuthenticationInSetupStateOnLogin(UserAccount user);
void verifyCallerPrivilegeForUserOrAccountOperations(Account userAccount);

View File

@ -1535,6 +1535,12 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
checkApiAccess(apiCheckers, caller, command, keyPairPermissions.toArray(new ApiKeyPairPermission[0]));
}
@Override
public void checkApiAccess(Account caller, String command) {
List<APIChecker> apiCheckers = getEnabledApiCheckers();
checkApiAccess(apiCheckers, caller, command);
}
@NotNull
private List<APIChecker> getEnabledApiCheckers() {
// we are really only interested in the dynamic access checker