@@ -1579,16 +1579,20 @@ public UserAccount updateUser(UpdateUserCmd updateUserCmd) {
1579
1579
public void verifyCallerPrivilegeForUserOrAccountOperations (Account userAccount ) {
1580
1580
logger .debug (String .format ("Verifying whether the caller has the correct privileges based on the user's role type and API permissions: %s" , userAccount ));
1581
1581
1582
- checkCallerRoleTypeAllowedForUserOrAccountOperations (userAccount , null );
1583
- checkCallerApiPermissionsForUserOrAccountOperations (userAccount );
1582
+ if (!Account .Type .PROJECT .equals (userAccount .getType ())) {
1583
+ checkCallerRoleTypeAllowedForUserOrAccountOperations (userAccount , null );
1584
+ checkCallerApiPermissionsForUserOrAccountOperations (userAccount );
1585
+ }
1584
1586
}
1585
1587
1586
1588
protected void verifyCallerPrivilegeForUserOrAccountOperations (User user ) {
1587
1589
logger .debug (String .format ("Verifying whether the caller has the correct privileges based on the user's role type and API permissions: %s" , user ));
1588
1590
1589
1591
Account userAccount = getAccount (user .getAccountId ());
1590
- checkCallerRoleTypeAllowedForUserOrAccountOperations (userAccount , user );
1591
- checkCallerApiPermissionsForUserOrAccountOperations (userAccount );
1592
+ if (!Account .Type .PROJECT .equals (userAccount .getType ())) {
1593
+ checkCallerRoleTypeAllowedForUserOrAccountOperations (userAccount , user );
1594
+ checkCallerApiPermissionsForUserOrAccountOperations (userAccount );
1595
+ }
1592
1596
}
1593
1597
1594
1598
protected void checkCallerRoleTypeAllowedForUserOrAccountOperations (Account userAccount , User user ) {
@@ -1597,7 +1601,7 @@ protected void checkCallerRoleTypeAllowedForUserOrAccountOperations(Account user
1597
1601
RoleType userAccountRoleType = getRoleType (userAccount );
1598
1602
1599
1603
if (RoleType .Unknown == callerRoleType || RoleType .Unknown == userAccountRoleType ) {
1600
- String errMsg = String .format ("The role type of account [%s, %s] or [%s, %s] is unknown" ,
1604
+ String errMsg = String .format ("The role type of caller account [%s, %s] or target account [%s, %s] is unknown" ,
1601
1605
callingAccount .getName (), callingAccount .getUuid (), userAccount .getName (), userAccount .getUuid ());
1602
1606
throw new PermissionDeniedException (errMsg );
1603
1607
}
@@ -2707,10 +2711,8 @@ public AccountVO createAccount(final String accountName, final Account.Type acco
2707
2711
}
2708
2712
}
2709
2713
2710
- if (!Account .Type .PROJECT .equals (accountType )) {
2711
- AccountVO newAccount = new AccountVO (accountName , domainId , networkDomain , accountType , roleId , uuid );
2712
- verifyCallerPrivilegeForUserOrAccountOperations (newAccount );
2713
- }
2714
+ AccountVO newAccount = new AccountVO (accountName , domainId , networkDomain , accountType , roleId , uuid );
2715
+ verifyCallerPrivilegeForUserOrAccountOperations (newAccount );
2714
2716
2715
2717
// Create the account
2716
2718
return Transaction .execute (new TransactionCallback <>() {
0 commit comments