Skip to content

Commit c645292

Browse files
Update server/src/main/java/com/cloud/user/AccountManagerImpl.java
Co-authored-by: dahn <daan.hoogland@gmail.com>
1 parent 29a09c2 commit c645292

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,31 +2110,30 @@ public boolean deleteUserAccount(long accountId) {
21102110
return deleteAccount(account, callerUserId, caller);
21112111
}
21122112

2113-
protected void checkIfAccountManagesProjects(long accountId) {
2114-
List<Long> managedProjectIds = _projectAccountDao.listAdministratedProjectIds(accountId);
2113+
protected void checkIfAccountManagesProjects(long accountId) {
2114+
List<Long> managedProjectIds = _projectAccountDao.listAdministratedProjectIds(accountId);
21152115

2116-
if (CollectionUtils.isEmpty(managedProjectIds)) {
2117-
return;
2118-
}
2116+
if (CollectionUtils.isEmpty(managedProjectIds)) {
2117+
return;
2118+
}
21192119

2120-
List<Long> activeManagedProjects = new ArrayList<>();
2120+
List<Long> activeManagedProjects = new ArrayList<>();
21212121

2122-
for (Long projectId : managedProjectIds) {
2123-
ProjectVO project = _projectDao.findById(projectId);
2124-
if (project != null && project.getRemoved() == null) {
2125-
activeManagedProjects.add(projectId);
2122+
for (Long projectId : managedProjectIds) {
2123+
ProjectVO project = _projectDao.findById(projectId);
2124+
if (project != null && project.getRemoved() == null) {
2125+
activeManagedProjects.add(projectId);
2126+
}
21262127
}
2127-
}
21282128

2129-
if (!activeManagedProjects.isEmpty()) {
2130-
throw new InvalidParameterValueException(
2131-
String.format(
2132-
"Unable to delete account [%s], because it manages the following project(s): %s. Please, remove the account from these projects or demote it to a regular project role first.",
2133-
accountId, activeManagedProjects
2134-
)
2135-
);
2129+
if (!activeManagedProjects.isEmpty()) {
2130+
throw new InvalidParameterValueException(
2131+
String.format(
2132+
"Unable to delete account [%s], because it manages the following project(s): %s. Please, remove the account from these projects or demote it to a regular project role first.",
2133+
accountId, activeManagedProjects
2134+
));
2135+
}
21362136
}
2137-
}
21382137

21392138

21402139
protected boolean isDeleteNeeded(AccountVO account, long accountId, Account caller) {

0 commit comments

Comments
 (0)