nvazquez commented on a change in pull request #3694: Ldap fixes
URL: https://github.com/apache/cloudstack/pull/3694#discussion_r358932516
 
 

 ##########
 File path: 
plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LdapListUsersCmd.java
 ##########
 @@ -104,20 +241,251 @@ public long getEntityOwnerId() {
         return Account.ACCOUNT_ID_SYSTEM;
     }
 
-    private String getListType() {
+    String getListTypeString() {
         return listType == null ? "all" : listType;
     }
 
-    private boolean isACloudstackUser(final LdapUser ldapUser) {
-        final ListResponse<UserResponse> response = 
_queryService.searchForUsers(new ListUsersCmd());
-        final List<UserResponse> cloudstackUsers = response.getResponses();
+    String getUserFilterString() {
+        return userFilter == null ? getListTypeString() == null ? "NoFilter" : 
getListTypeString().equals("all") ? "NoFilter" : "AnyDomain" : userFilter;
+    }
+
+    UserFilter getUserFilter() {
+        return UserFilter.fromString(getUserFilterString());
+    }
+
+    boolean isACloudstackUser(final LdapUser ldapUser) {
+        boolean rc = false;
+        final List<UserResponse> cloudstackUsers = getCloudstackUsers();
+        if (cloudstackUsers != null) {
+            for (final UserResponse cloudstackUser : cloudstackUsers) {
+                if 
(ldapUser.getUsername().equals(cloudstackUser.getUsername())) {
 
 Review comment:
   Can you also add StringUtils.isNotBlank() check?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to