Skip to content

LDAP-Groups not found due to not using a filter #4201

Description

@M4ui

Expected behaviour

ownCloud should show me the group I am looking for when I type its name in the sharing dialogue.

Actual behaviour

Sometimes it does find the groups and shows them, but sometimes it does not.

The problem

We have an LDAP-Server which contains thousands of groups, but its response is limited to 500 entries. When I type in the name of the group I am looking for /owncloud/core/ajax/share.php is called and it tries to retrieve all the groups. So basically you are getting all the groups there are and you are searching this data instead of letting the LDAP-Server handle the search (please correct me if I am wrong). If I get lucky the 500 groups in the response contain the group I am looking for and ownCloud shows it to me, but a lot of times it does not.

Possible solution

Instead of doing the search yourself you could just give the LDAP-Server a filter and it would do the searching for you. Since the method getGroups has a parameter called "filter" I would suggest you pass it the value of whatever is inside of the text field of the sharing dialogue.

Changing line 182 in share.php from:

$groups = OC_Group::getGroups();

to:

$groups = OC_Group::getGroups($_GET['search']);

did the trick for me.

Server configuration

Operating system: Red Hat Enterprise Linux Server 6.3

Web server: Apache 2.2.15

Database: MySQL 5.5.32

PHP version: 5.4.17

ownCloud version: 5.0.9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions