Limiting LDAP sync_user script

Limiting LDAP sync_user script

by Peter Easton -
Number of replies: 5

Hi All,

We've recently upgraded to moodle 2.8.x and now the script never seems to finish.

We have a huge 170k user base in our ldap server but on have a max of 13k moodle users.

Back in 1.8x moodle we modified the script to limit the script by adding:

            $filter="(&$filter(destinationIndicator=enabled))";

and it limited the sync to a more manageable 13k of users to sync but I can't figure out where to edit in the new version.


any pointers or guidance would be greatly appreciated

Pete

Average of ratings: -
In reply to Peter Easton

Re: Limiting LDAP sync_user script

by Peter Easton -

I found it (i think, i'm testing)

file: auth.php

line: 703   

       $filter = '(&('.$this->config->user_attribute.'=*)'.$this->config->objectclass.')';

add after it:

        $filter="(&$filter(destinationIndicator=enabled))";


if it works hopefully someone else can use it or they can add a filter field to the ldap interface

Pete

In reply to Peter Easton

Re: Limiting LDAP sync_user script

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I just filter from the ldap server settings page.  Works well.

In reply to Emma Richardson

Re: Limiting LDAP sync_user script

by Peter Easton -

where are you adding filters on the settings page?


Pete

In reply to Peter Easton

Re: Limiting LDAP sync_user script

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Under Object Class.  For example:

(|(&(objectClass=user)(!(objectClass=computer))(memberOf=cn=MoodleUser,ou=people ,dc=mydomain,dc=com)))

This is how mine is setup - only syncs users in the MoodleUser security group.  Works great!

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Limiting LDAP sync_user script

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

For community reference, see also MDL-47004: there, it will be discussed the default Moodle setup which could be even something similar to the one above to exclude the Computer accounts.

HTH,
Matteo