From: paca70 Date: Mon, 16 Aug 2004 04:56:47 +0000 (+0000) Subject: Added support for coursecreators in function auth_sync_users() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=443398353c91056bc62d8a8b67f336faa84414dc;p=moodle.git Added support for coursecreators in function auth_sync_users() --- diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php index 92b7fd80c7..e8ef16b620 100644 --- a/auth/ldap/lib.php +++ b/auth/ldap/lib.php @@ -279,6 +279,25 @@ function auth_sync_users () { } else { //update username set_field('user', 'username', $user->username , 'auth', 'ldap', 'guid', $user->guid); + //no id-information in ldap so get now + $userid = get_field('user', 'id', 'auth', 'ldap', 'guid', $user->guid); + + if (auth_iscreator($user->username)) { + if (! record_exists("user_coursecreators", "userid", $userid)) { + $cdata['userid']=$userid; + $creator = insert_record("user_coursecreators",$cdata); + if (! $creator) { + error("Cannot add user to course creators."); + } + } + } else { + if ( record_exists("user_coursecreators", "userid", $userid)) { + $creator = delete_records("user_coursecreators", "userid", $userid); + if (! $creator) { + error("Cannot remove user from course creators."); + } + } + } } }