Skip to content

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

Closed

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

Activity

  1. blizzz commented on Aug 17, 2013

    @blizzz
    Contributor

    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).

    Let me correct you :) See group search attributes

    Please revise your settings and try it out again.

  2. M4ui commented on Aug 19, 2013

    @M4ui
    Author

    Let me correct you :) See group search attributes
    Please revise your settings and try it out again.

    I have already tried setting the group search attributes, this did not help. By using the group search attributes I am only able to compare attributes to some hardcoded values/strings.
    It would help if I could set a filter to compare e.g. the cn to whatever the user entered, but as far as I know such a comparison is only possible for the User Login Filter.

  3. blizzz commented on Aug 19, 2013

    @blizzz
    Contributor

    The search string is passed to the configured attributes, just like in the login filter.

  4. M4ui commented on Aug 19, 2013

    @M4ui
    Author

    I just tried setting the group search attribute to 'cn=%uid', this did not change anything and I think it would limit the results to groups which names contain my username, but now I cannot find any groups, not even the group which matches my username.

  5. blizzz commented on Aug 19, 2013

    @blizzz
    Contributor

    No, you just specify "cn". ownCloud will automatically insert the search query. Placeholders are neither required nor valid/possible.

  6. M4ui commented on Aug 19, 2013

    @M4ui
    Author

    No, you just specify "cn". ownCloud will automatically insert the search query. Placeholders are neither required nor valid/possible.

    Oh, I misunderstood the documentation..
    Nevertheless after specifying "cn" instead of "cn=%uid", I still cannot find any LDAP-groups.
    Tried setting and resetting multiple times and restarting apache.

  7. blizzz commented on Aug 21, 2013

    @blizzz
    Contributor

    Oh, yeah, the LDAP Backend does everything fine, but the search dialogue does not search properly. Stay tuned, should be resolved soon.

  8. added a commit that references this issue on Aug 21, 2013
    bf933c7
  9. added a commit that references this issue on Aug 22, 2013
    018a64b
  10. locked as resolved and limited conversation to collaborators on Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions