mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +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.
|
||||
*
|
||||
* @param relevantAttributes
|
||||
* The attribute(s) relevant to return for this search,
|
||||
* if all available should be returned pass null as value.
|
||||
* The attribute(s) relevant to return for this search, or null if all
|
||||
* available attributes should be returned.
|
||||
*
|
||||
* @return
|
||||
* 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
|
||||
SearchRequest request = ldapService.getSearchRequest(baseDN, query);
|
||||
if (relevantAttributes != null) {
|
||||
|
||||
if (relevantAttributes != null)
|
||||
request.addAttributes(relevantAttributes.toArray(new String[0]));
|
||||
}
|
||||
|
||||
// Produce list of all entries in the search result, automatically
|
||||
// following referrals if configured to do so
|
||||
|
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
package org.apache.guacamole.auth.ldap.group;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -192,7 +192,8 @@ public class UserGroupService {
|
||||
ldapConnection,
|
||||
userDN,
|
||||
confService.getUserSearchFilter(),
|
||||
0, null);
|
||||
0,
|
||||
null);
|
||||
// ... there can surely only be one
|
||||
if (userEntries.size() != 1)
|
||||
logger.warn("user DN \"{}\" does not return unique value "
|
||||
@@ -215,15 +216,11 @@ public class UserGroupService {
|
||||
}
|
||||
|
||||
// Gather all attributes relevant for a group
|
||||
ArrayList<String> groupAttributes = new ArrayList<String>();
|
||||
List<String> groupAttributes = confService.getGroupNameAttributes();
|
||||
groupAttributes.add(confService.getMemberAttribute());
|
||||
confService.getGroupNameAttributes().forEach(
|
||||
attribute -> groupAttributes.add(attribute)
|
||||
);
|
||||
|
||||
// Get all groups the user is a member of starting at the groupBaseDN,
|
||||
// excluding guacConfigGroups
|
||||
|
||||
return queryService.search(
|
||||
ldapConnection,
|
||||
groupBaseDN,
|
||||
|
Reference in New Issue
Block a user