Skip to content

Commit fc317f3

Browse files
Apply suggestions from code review
Co-authored-by: Pearl Dsilva <[email protected]>
1 parent eb173d5 commit fc317f3

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LdapImportUsersCmd.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ public LdapImportUsersCmd(final LdapManager ldapManager, final DomainService dom
105105
private void createCloudstackUserAccount(LdapUser user, String accountName, Domain domain) {
106106
Account account = _accountService.getActiveAccountByName(accountName, domain.getId());
107107
if (account == null) {
108-
logger.debug("No account exists with name: {} creating the account and an user with name: {} in the account", accountName, user.getUsername());
108+
logger.debug("No account exists with name: {}. Creating the account and a user with name: {} in the account", accountName, user.getUsername());
109109
_accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, getAccountType(), getRoleId(),
110110
domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
111111
} else {
112112
// check if the user exists. if yes, call update
113113
UserAccount csuser = _accountService.getActiveUserAccount(user.getUsername(), domain.getId());
114114
if (csuser == null) {
115-
logger.debug("No user exists with name: {} creating a user in the account: {}", user.getUsername(), accountName);
115+
logger.debug("No user exists with name: {}. Creating a user in the account: {}", user.getUsername(), accountName);
116116
_accountService.createUser(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, domain.getId(),
117117
UUID.randomUUID().toString(), User.Source.LDAP);
118118
} else {
@@ -201,11 +201,11 @@ private Domain getDomainForName(String name) {
201201
private Domain getDomain(LdapUser user) {
202202
Domain domain;
203203
if (_domain != null) {
204-
//this means either domain id or group name is passed and this will be same for all the users in this call. hence returning it.
204+
// This means that either a domain id or group name is passed and this will be same for all the users in this call, hence returning it.
205205
domain = _domain;
206206
} else {
207207
if (domainId != null) {
208-
// a domain ID is passed. use it for this user and all the users in the same api call (by setting _domain)
208+
// a domain ID is passed. Use it for this user and all the users in the same API call (by setting _domain)
209209
domain = _domain = _domainService.getDomain(domainId);
210210
} else {
211211
// a group name is passed. use it for this user and all the users in the same api call(by setting _domain)

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LdapListUsersCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private boolean isACloudStackUser(String username) {
223223
if (CollectionUtils.isNotEmpty(cloudstackUsers)) {
224224
for (final UserResponse cloudstackUser : cloudstackUsers) {
225225
if (username.equals(cloudstackUser.getUsername())) {
226-
logger.trace("found user {} in cloudstack user {}", username, cloudstackUser.getUsername());
226+
logger.trace("Found user {} in CloudStack", cloudstackUser.getUsername());
227227
rc = true;
228228
break;
229229
} else {
@@ -414,7 +414,7 @@ public List<LdapUserResponse> filterPotentialImport(List<LdapUserResponse> input
414414
logger.trace("should be filtering potential imports!!!");
415415
}
416416
// functional possibility do not add only users not yet in cloudstack but include users that would be moved if they are so in ldap?
417-
// this means if they are part of an account linked to a ldap group/ou
417+
// This means if they are part of an Account linked to an LDAP Group/OU
418418
input.removeIf(ldapUser ->
419419
(
420420
(isACloudStackUser(ldapUser))

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public Pair<Boolean, ActionOnFailedAuthentication> authenticate(final String use
9191
}
9292
} else {
9393
if (logger.isTraceEnabled()) {
94-
logger.trace("'this' domain ({}) is not linked to ldap follow normal authentication", domainId);
94+
logger.trace("'this' domain ({}) is not linked to LDAP follow normal authentication", domainId);
9595
}
9696
rc = authenticate(username, password, domainId, user);
9797
}

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private LdapConfigurationResponse addConfigurationInternal(final String hostname
180180
context = _ldapContextFactory.createBindContext(providerUrl,domainId);
181181
configuration = new LdapConfigurationVO(hostname, port, domainId);
182182
_ldapConfigurationDao.persist(configuration);
183-
logger.info("Added new ldap server with url: {}{}", providerUrl, domainId == null ? "" : " for domain " + domainId);
183+
logger.info("Added a new LDAP server with URL: {}{}", providerUrl, domainId == null ? "" : " for domain " + domainId);
184184
return createLdapConfigurationResponse(configuration);
185185
} catch (NamingException | IOException e) {
186186
logger.debug("NamingException while doing an LDAP bind", e);
@@ -215,7 +215,7 @@ public boolean canAuthenticate(final String principal, final String password, fi
215215
return true;
216216
} catch (NamingException | IOException e) {/* AuthenticationException is caught as NamingException */
217217
logger.debug("Exception while doing an LDAP bind for user {}", principal, e);
218-
logger.info("Failed to authenticate user: {}. incorrect password.", principal);
218+
logger.info("Failed to authenticate user: {}. Incorrect password.", principal);
219219
return false;
220220
}
221221
}

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/dao/LdapConfigurationDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
public interface LdapConfigurationDao extends GenericDao<LdapConfigurationVO, Long> {
3030
/**
3131
* @deprecated there might well be more then one ldap implementation on a host and or a double binding of several domains
32-
* @param hostname the hostname or ip address of the ldap server
33-
* @return the ldap configuration for the given hostname
32+
* @param hostname the hostname or ip address of the LDAP server
33+
* @return the LDAP configuration for the given hostname
3434
*/
3535
@Deprecated
3636
LdapConfigurationVO findByHostname(String hostname);

0 commit comments

Comments
 (0)