Skip to content

Commit 1f50e61

Browse files
author
Glover, Rene (rg9975)
committed
updates from PR feedback
1 parent fdb654b commit 1f50e61

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ public static AuthnRequest buildAuthnRequestObject(final String authnId, final S
205205
authnRequest.setAssertionConsumerServiceURL(consumerUrl);
206206
authnRequest.setProviderName(spId);
207207
authnRequest.setIssuer(issuer);
208-
//authnRequest.setRequestedAuthnContext(requestedAuthnContext);
209208

210209
return authnRequest;
211210
}

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,9 +1447,7 @@ public UserVO createUser(String userName, String password, String firstName, Str
14471447
List<UserVO> duplicatedUsers = _userDao.findUsersByName(userName);
14481448
for (UserVO duplicatedUser : duplicatedUsers) {
14491449
// users can't exist in same account
1450-
if (duplicatedUser.getAccountId() == account.getId()) {
1451-
throw new InvalidParameterValueException(String.format("Username [%s] already exists in account [id=%s,name=%s]", duplicatedUser.getUsername(), account.getUuid(), account.getAccountName()));
1452-
}
1450+
assertUserAlreadyInAccount(duplicatedUser, account);
14531451
}
14541452

14551453
UserVO user = null;
@@ -1592,15 +1590,7 @@ protected void validateAndUpdateUsernameIfNeeded(UpdateUserCmd updateUserCmd, Us
15921590
}
15931591

15941592
// users can't exist in same account
1595-
if (duplicatedUser.getAccountId() == account.getId()) {
1596-
throw new InvalidParameterValueException(String.format("Username [%s] already exists in account [id=%s,name=%s]", duplicatedUser.getUsername(), account.getUuid(), account.getAccountName()));
1597-
}
1598-
1599-
/**Account duplicatedUserAccountWithUserThatHasTheSameUserName = _accountDao.findById(duplicatedUser.getAccountId());
1600-
if (duplicatedUserAccountWithUserThatHasTheSameUserName.getDomainId() == account.getDomainId()) {
1601-
DomainVO domain = _domainDao.findById(duplicatedUserAccountWithUserThatHasTheSameUserName.getDomainId());
1602-
throw new InvalidParameterValueException(String.format("Username [%s] already exists in domain [id=%s,name=%s]", duplicatedUser.getUsername(), domain.getUuid(), domain.getName()));
1603-
}*/
1593+
assertUserAlreadyInAccount(duplicatedUser, account);
16041594
}
16051595
user.setUsername(userName);
16061596
}
@@ -3522,4 +3512,10 @@ public UserAccount clearUserTwoFactorAuthenticationInSetupStateOnLogin(UserAccou
35223512
return userAccountVO;
35233513
});
35243514
}
3515+
3516+
private void assertUserAlreadyInAccount(User user, Account account) {
3517+
if (user.getAccountId() == account.getId()) {
3518+
throw new InvalidParameterValueException(String.format("Username [%s] already exists in account [id=%s,name=%s]", user.getUsername(), account.getUuid(), account.getAccountName()));
3519+
}
3520+
}
35253521
}

ui/src/components/header/SamlDomainSwitcher.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<script>
5353
import store from '@/store'
5454
import { api } from '@/api'
55-
// import _ from 'lodash'
55+
import _ from 'lodash'
5656
5757
export default {
5858
name: 'SamlDomainSwitcher',
@@ -89,7 +89,7 @@ export default {
8989
return
9090
}
9191
this.samlAccounts = samlAccounts
92-
// this.samlAccounts =_.orderBy(samlAccounts, ['domainPath'], ['asc'])
92+
this.samlAccounts =_.orderBy(samlAccounts, ['domainPath'], ['asc'])
9393
const currentAccount = this.samlAccounts.filter(x => {
9494
return x.userId === store.getters.userInfo.id
9595
})[0]

0 commit comments

Comments
 (0)