LDAP - synchronization

Re: LDAP - synchronization

by Visvanath Ratnaweera -
Number of replies: 4
Picture of Particularly helpful Moodlers Picture of Translators
Forgot to mention earlier: There is enrol/ldap/enrol_ldap_sync.php which similar to auth/ldap/auth_ldap_sync_users.php but creates all the courses instead.

If you run them in the correct order, first auth/ldap/auth_ldap_sync_users.php then enrol/ldap/enrol_ldap_sync.php, then the courses will be created and the users correctly enrolled.
In reply to Visvanath Ratnaweera

Re: LDAP - synchronization

by John Reese -

VR is correct...

run the script "/yourmoodlelocation/auth/ldap/auth_ldap_sync_users.php"  via cron to get all the users from your ldap over to moodle.

Be careful not to delete any ones that are already in Moodle but not in your LDAP directory. In other words, if you just want to add and not "remove", make sure the option to not delete is checked

In reply to John Reese

Re: LDAP - synchronization

by David Bolger -

Hi,

Is there a requirement that this runs from cron? I am trying to automatically load users from LDAP into Moodle without them having to log in first. I have found the auth_ldap_sync_users.php script, but when I try to run it manually (using "./auth_ldap_sync_users.php" I get a load of 'command not found' errors.


Is there other configuration required before I run this script? At present I have LDAP authentication turned on, so users are created from LDAP the first time a user tries to log in.

Thanks,

David

In reply to David Bolger

Re: LDAP - synchronization

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
php files need the PHP interpreter! The prescribed way is to change to the main moodle directory and call the PHP interpreter with the rights of the owner of the web server. For example,
$ cd /path/to/your/moodle/dir
$ sudo -u apache /usr/bin/php admin/cli/somescript.php --params

For details see http://docs.moodle.org/en/Administration_via_command_line.
In reply to John Reese

Re: LDAP - synchronization

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
On 12 April 2012 John Reese wrote:
> run the script "/yourmoodlelocation/auth/ldap/auth_ldap_sync_users.php" via cron to get all the users from your ldap over to moodle.

Just a caution: Keep in mind that auth_ldap_sync_users.php is not one three things, depending on Administration -> Users -> Authentication -> LDAP server -> Cron synchronization script = Keep internal or Suspend internal or Full delete internal. See http://moodle.org/mod/forum/discuss.php?d=201783.