Apply suggestion from @abh1sar

Co-authored-by: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
This commit is contained in:
dahn 2026-03-30 10:59:36 +02:00 committed by Daan Hoogland
parent 2b2d5fa26f
commit 773dea9bae
1 changed files with 2 additions and 1 deletions

View File

@ -5604,7 +5604,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
}
private void checkForceStopVmPermission(Account callingAccount) {
if (callingAccount == null || !AllowUserForceStopVm.valueIn(callingAccount.getId())) {
callingAccountId = callingAccount == null ? null : callingAccount.getId();
if (!AllowUserForceStopVm.valueIn(callingAccountId)) {
logger.error("Parameter [{}] can only be passed by Admin accounts or when the allow.user.force.stop.vm config is true for the account.", ApiConstants.FORCED);
throw new PermissionDeniedException("Account does not have the permission to force stop the vm.");
}