Permalink
Browse files

Added support for coursecreators in function auth_sync_users()

  • Loading branch information...
1 parent 9566e4c commit 443398353c91056bc62d8a8b67f336faa84414dc paca70 committed Aug 16, 2004
Showing with 19 additions and 0 deletions.
  1. +19 −0 auth/ldap/lib.php
View
19 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.");
+ }
+ }
+ }
}
}

0 comments on commit 4433983

Please sign in to comment.