Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ public void execute() {
CallContext.current().setEventDetails("Account ID: " + (account != null ? account.getUuid() : getId())); // Account not found is already handled by service

boolean result = _regionService.deleteUserAccount(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
if (!result) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
}
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
}

@Override
Expand Down
10 changes: 9 additions & 1 deletion server/src/main/java/com/cloud/user/AccountManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,15 @@ public boolean deleteUserAccount(long accountId) {
// If the user is a System user, return an error. We do not allow this
AccountVO account = _accountDao.findById(accountId);

if (! isDeleteNeeded(account, accountId, caller)) {
if (caller.getId() == accountId) {
Domain domain = _domainDao.findById(account.getDomainId());
throw new InvalidParameterValueException(String.format("The caller is requesting to delete their own account. As a security measure, ACS will not allow this " +
Comment thread
sureshanaparti marked this conversation as resolved.
Outdated
"operation." +
"To delete account %s (ID: %s, Domain: %s), request to another user with permission to execute the operation.",
account.getAccountName(), account.getUuid(), domain.getUuid()));
}

if (!isDeleteNeeded(account, accountId, caller)) {
return true;
}

Expand Down