]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for MDL-6928, correcting checks for auth_iscreator
authortoyomoyo <toyomoyo>
Wed, 15 Nov 2006 03:40:18 +0000 (03:40 +0000)
committertoyomoyo <toyomoyo>
Wed, 15 Nov 2006 03:40:18 +0000 (03:40 +0000)
lib/moodlelib.php

index e494b1d461368e060a61977ea31104cb72360845..a612c0c09b97fdcc188858ec610f117a5422f427 100644 (file)
@@ -2381,41 +2381,16 @@ function authenticate_user_login($username, $password) {
         } else {
             $user = create_user_record($username, $password, $auth);
         }
-
-/*
-        if (function_exists('auth_iscreator')) {    // Check if the user is a creator
-            $useriscreator = auth_iscreator($username);
-            if (!is_null($useriscreator)) {
-                if ($useriscreator) {
-                    if (! record_exists('user_coursecreators', 'userid', $user->id)) {
-                        $cdata->userid = $user->id;
-                        if (! insert_record('user_coursecreators', $cdata)) {
-                            error('Cannot add user to course creators.');
-                        }
-                    }
-                } else {
-                    if (record_exists('user_coursecreators', 'userid', $user->id)) {
-                        if (! delete_records('user_coursecreators', 'userid', $user->id)) {
-                            error('Cannot remove user from course creators.');
-                        }
-                    }
-                }
-            }
-        }
-*/
-        // fix for MDL-6928
-        
+        // fix for MDL-6928    
         if (function_exists('auth_iscreator')) {                    
             $sitecontext = get_context_instance(CONTEXT_SYSTEM);
             if ($creatorroles = get_roles_with_capability('moodle/legacy:coursecreator', CAP_ALLOW)) {
                 $creatorrole = array_shift($creatorroles); // We can only use one, let's use the first one
                 // Check if the user is a creator
                 if (auth_iscreator($username)) { // Following calls will not create duplicates
-                    if ($useriscreator) {
-                       role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
-                    } else {
-                       role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
-                    }
+                    role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
+                } else {
+                    role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
                 }
             }
         }