Prevent auth_iscreator from overriding users course creation status

This commit is contained in:
paca70
2004-10-13 07:27:34 +00:00
parent 00c6364cbb
commit a67dd90008
2 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -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
View File
@@ -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;