Copilot commented on code in PR #11436:
URL: https://github.com/apache/cloudstack/pull/11436#discussion_r2272354145
##########
plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/OpenLdapUserManagerImpl.java:
##########
@@ -75,23 +75,21 @@ protected LdapUser createUser(final SearchResult result,
Long domainId) throws N
}
private String generateSearchFilter(final String username, Long domainId) {
- final StringBuilder userObjectFilter = new StringBuilder();
- userObjectFilter.append("(objectClass=");
- userObjectFilter.append(_ldapConfiguration.getUserObject(domainId));
- userObjectFilter.append(")");
-
- final StringBuilder usernameFilter = new StringBuilder();
- usernameFilter.append("(");
-
usernameFilter.append(_ldapConfiguration.getUsernameAttribute(domainId));
- usernameFilter.append("=");
- usernameFilter.append((username == null ? "*" :
LdapUtils.escapeLDAPSearchFilter(username)));
- usernameFilter.append(")");
-
- String memberOfAttribute =
_ldapConfiguration.getUserMemberOfAttribute(domainId);
+ String userObjectFilter = "(objectClass=" +
+ LdapConfiguration.getUserObject(domainId) +
+ ")";
+
+ String usernameFilter = "(" +
+ LdapConfiguration.getUsernameAttribute(domainId) +
+ "=" +
+ (username == null ? "*" :
LdapUtils.escapeLDAPSearchFilter(username)) +
+ ")";
+
+ String memberOfAttribute =
LdapConfiguration.getUserMemberOfAttribute(domainId);
StringBuilder ldapGroupsFilter = new StringBuilder();
// this should get the trustmaps for this domain
List<String> ldapGroups = getMappedLdapGroups(domainId);
- if (null != ldapGroups && ldapGroups.size() > 0) {
+ if (CollectionUtils.isNotEmpty(ldapGroups)) {
Review Comment:
The CollectionUtils class is used but not imported. This will cause a
compilation error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]