@@ -1297,7 +1297,7 @@ public UserAccount createUserAccount(final String userName, final String passwor
12971297 // Check permissions
12981298 checkAccess (getCurrentCallingAccount (), domain );
12991299
1300- if (!userAllowMultipleAccounts .valueInDomain ( domainId ) && !_userAccountDao .validateUsernameInDomain (userName , domainId )) {
1300+ if (!userAllowMultipleAccounts .valueInScope ( ConfigKey . Scope . Domain , domainId ) && !_userAccountDao .validateUsernameInDomain (userName , domainId )) {
13011301 throw new InvalidParameterValueException (String .format ("The user %s already exists in domain %s" , userName , domain ));
13021302 }
13031303
@@ -1485,7 +1485,7 @@ public UserVO createUser(String userName, String password, String firstName, Str
14851485 throw new PermissionDeniedException (String .format ("Account: %s is a system account, can't add a user to it" , account ));
14861486 }
14871487
1488- if (!userAllowMultipleAccounts .valueInDomain ( domainId ) && !_userAccountDao .validateUsernameInDomain (userName , domainId )) {
1488+ if (!userAllowMultipleAccounts .valueInScope ( ConfigKey . Scope . Domain , domainId ) && !_userAccountDao .validateUsernameInDomain (userName , domainId )) {
14891489 throw new CloudRuntimeException ("The user " + userName + " already exists in domain " + domainId );
14901490 }
14911491 List <UserVO > duplicatedUsers = _userDao .findUsersByName (userName );
@@ -1636,7 +1636,7 @@ protected void validateAndUpdateUsernameIfNeeded(UpdateUserCmd updateUserCmd, Us
16361636 }
16371637
16381638 // duplicate usernames cannot exist in same domain unless explicitly configured
1639- if (!userAllowMultipleAccounts .valueInDomain ( newAccount .getDomainId ())) {
1639+ if (!userAllowMultipleAccounts .valueInScope ( ConfigKey . Scope . Domain , newAccount .getDomainId ())) {
16401640 assertUserNotAlreadyInDomain (existingUser , newAccount );
16411641 }
16421642
0 commit comments