mirror of https://github.com/apache/cloudstack.git
api: fix account deletion event description (#3483)
Fix account deletion event description. Fixes #3109 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
1bf4dd39ca
commit
b40fdbb2f7
|
|
@ -18,8 +18,6 @@ package org.apache.cloudstack.api.command.admin.account;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -33,10 +31,10 @@ import org.apache.cloudstack.api.response.AccountResponse;
|
|||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.region.RegionService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
|
||||
@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
|
|
@ -92,14 +90,15 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
User user = _responseGenerator.findUserById(getId());
|
||||
return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId())
|
||||
: "user delete, but this user does not exist in the system");
|
||||
Account account = _accountService.getAccount(getId());
|
||||
return (account != null ? "Deleting user account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users"
|
||||
: "Account delete, but this account does not exist in the system");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Account Id: " + getId());
|
||||
Account account = _accountService.getAccount(getId());
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue