mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-1130: Correct style issues and simplify the code that builds group attribute arrays.
This commit is contained in:
@@ -199,8 +199,8 @@ public class ObjectQueryService {
|
|||||||
* limiting the maximum depth to which referrals can go.
|
* limiting the maximum depth to which referrals can go.
|
||||||
*
|
*
|
||||||
* @param relevantAttributes
|
* @param relevantAttributes
|
||||||
* The attribute(s) relevant to return for this search,
|
* The attribute(s) relevant to return for this search, or null if all
|
||||||
* if all available should be returned pass null as value.
|
* available attributes should be returned.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* A list of all results accessible to the user currently bound under
|
* A list of all results accessible to the user currently bound under
|
||||||
@@ -230,9 +230,9 @@ public class ObjectQueryService {
|
|||||||
|
|
||||||
// Search within subtree of given base DN
|
// Search within subtree of given base DN
|
||||||
SearchRequest request = ldapService.getSearchRequest(baseDN, query);
|
SearchRequest request = ldapService.getSearchRequest(baseDN, query);
|
||||||
if (relevantAttributes != null) {
|
|
||||||
|
if (relevantAttributes != null)
|
||||||
request.addAttributes(relevantAttributes.toArray(new String[0]));
|
request.addAttributes(relevantAttributes.toArray(new String[0]));
|
||||||
}
|
|
||||||
|
|
||||||
// Produce list of all entries in the search result, automatically
|
// Produce list of all entries in the search result, automatically
|
||||||
// following referrals if configured to do so
|
// following referrals if configured to do so
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.guacamole.auth.ldap.group;
|
package org.apache.guacamole.auth.ldap.group;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -192,7 +192,8 @@ public class UserGroupService {
|
|||||||
ldapConnection,
|
ldapConnection,
|
||||||
userDN,
|
userDN,
|
||||||
confService.getUserSearchFilter(),
|
confService.getUserSearchFilter(),
|
||||||
0, null);
|
0,
|
||||||
|
null);
|
||||||
// ... there can surely only be one
|
// ... there can surely only be one
|
||||||
if (userEntries.size() != 1)
|
if (userEntries.size() != 1)
|
||||||
logger.warn("user DN \"{}\" does not return unique value "
|
logger.warn("user DN \"{}\" does not return unique value "
|
||||||
@@ -215,15 +216,11 @@ public class UserGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gather all attributes relevant for a group
|
// Gather all attributes relevant for a group
|
||||||
ArrayList<String> groupAttributes = new ArrayList<String>();
|
List<String> groupAttributes = confService.getGroupNameAttributes();
|
||||||
groupAttributes.add(confService.getMemberAttribute());
|
groupAttributes.add(confService.getMemberAttribute());
|
||||||
confService.getGroupNameAttributes().forEach(
|
|
||||||
attribute -> groupAttributes.add(attribute)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Get all groups the user is a member of starting at the groupBaseDN,
|
// Get all groups the user is a member of starting at the groupBaseDN,
|
||||||
// excluding guacConfigGroups
|
// excluding guacConfigGroups
|
||||||
|
|
||||||
return queryService.search(
|
return queryService.search(
|
||||||
ldapConnection,
|
ldapConnection,
|
||||||
groupBaseDN,
|
groupBaseDN,
|
||||||
|
Reference in New Issue
Block a user