Skip to content

Commit 5be6b79

Browse files
harikrishna-patnalaDaan Hoogland
authored andcommitted
Skip verification of privileges on project accounts
1 parent a0080a0 commit 5be6b79

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,16 +1539,20 @@ public UserAccount updateUser(UpdateUserCmd updateUserCmd) {
15391539
public void verifyCallerPrivilegeForUserOrAccountOperations(Account userAccount) {
15401540
s_logger.debug(String.format("Verifying whether the caller has the correct privileges based on the user's role type and API permissions: %s", userAccount));
15411541

1542-
checkCallerRoleTypeAllowedForUserOrAccountOperations(userAccount, null);
1543-
checkCallerApiPermissionsForUserOrAccountOperations(userAccount);
1542+
if (!Account.Type.PROJECT.equals(userAccount.getType())) {
1543+
checkCallerRoleTypeAllowedForUserOrAccountOperations(userAccount, null);
1544+
checkCallerApiPermissionsForUserOrAccountOperations(userAccount);
1545+
}
15441546
}
15451547

15461548
protected void verifyCallerPrivilegeForUserOrAccountOperations(User user) {
15471549
s_logger.debug(String.format("Verifying whether the caller has the correct privileges based on the user's role type and API permissions: %s", user));
15481550

15491551
Account userAccount = getAccount(user.getAccountId());
1550-
checkCallerRoleTypeAllowedForUserOrAccountOperations(userAccount, user);
1551-
checkCallerApiPermissionsForUserOrAccountOperations(userAccount);
1552+
if (!Account.Type.PROJECT.equals(userAccount.getType())) {
1553+
checkCallerRoleTypeAllowedForUserOrAccountOperations(userAccount, user);
1554+
checkCallerApiPermissionsForUserOrAccountOperations(userAccount);
1555+
}
15521556
}
15531557

15541558
protected void checkCallerRoleTypeAllowedForUserOrAccountOperations(Account userAccount, User user) {
@@ -2626,10 +2630,8 @@ public AccountVO createAccount(final String accountName, final Account.Type acco
26262630
}
26272631
}
26282632

2629-
if (!Account.Type.PROJECT.equals(accountType)) {
2630-
AccountVO newAccount = new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid);
2631-
verifyCallerPrivilegeForUserOrAccountOperations(newAccount);
2632-
}
2633+
AccountVO newAccount = new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid);
2634+
verifyCallerPrivilegeForUserOrAccountOperations(newAccount);
26332635

26342636
// Create the account
26352637
return Transaction.execute(new TransactionCallback<AccountVO>() {

0 commit comments

Comments
 (0)