Prevent auth_iscreator from overriding users course creation status
This commit is contained in:
+1
-1
@@ -368,7 +368,7 @@ function auth_iscreator($username=0) {
|
||||
}
|
||||
|
||||
if ((! $CFG->ldap_creators) OR (! $CFG->ldap_memberattribute)) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
return auth_ldap_isgroupmember($username, $CFG->ldap_creators);
|
||||
|
||||
+15
-12
@@ -949,20 +949,23 @@ function authenticate_user_login($username, $password) {
|
||||
}
|
||||
|
||||
if (function_exists('auth_iscreator')) { // Check if the user is a creator
|
||||
if (auth_iscreator($username)) {
|
||||
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.");
|
||||
$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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( record_exists("user_coursecreators", "userid", $user->id)) {
|
||||
if (! delete_records("user_coursecreators", "userid", $user->id)) {
|
||||
error("Cannot remove user from course creators.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $user;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user