public Map < String , UserGroup > getUserGroups ( LDAPConnection ldapConnection ) throws GuacamoleException { // Do not return any user groups if base DN is not specified String groupBaseDN = confService . getGroupBaseDN ( ) ; if ( groupBaseDN == null ) return Collections . emptyMap ( ) ; // Retrieve all visible user groups which are not guacConfigGroups Collection < String > attributes = confService . getGroupNameAttributes ( ) ; List < LDAPEntry > results = queryService . search ( ldapConnection , groupBaseDN , getGroupSearchFilter ( ) , attributes , null ) ; // Convert retrieved user groups to map of identifier to Guacamole // user group object return queryService . asMap ( results , entry -> { // Translate entry into UserGroup object having proper identifier String name = queryService . getIdentifier ( entry , attributes ) ; if ( name != null ) return new SimpleUserGroup ( name ) ; // Ignore user groups which lack a name attribute logger . debug ( "User group \"{}\" is missing a name attribute " + "and will be ignored." , entry . getDN ( ) ) ; return null ; } ) ; }
Returns all Guacamole user groups accessible to the user currently bound under the given LDAP connection .