Disappearing Course Creators

Disappearing Course Creators

by Robert McKerlie -
Number of replies: 13

Hi

We are currently running version 1.4.1 with LDAP authentication.  I have manually assigned users as course creators, and all appeared well.  However I made a recent addition to this list but from time to time the user in question gets bumped off the 'existing course creators list' and can be found back in the 'potential course creators list'!

Has anyone else experience this bizarre behavior?

Puzzled,

Robert
Average of ratings: -
In reply to Robert McKerlie

Re: Disappearing Course Creators

by Charlie Reisinger -
Robert-

We are seeing the same issue. LAMP, Moodle version 1.4 with LDAP authentication against Windows Active Directory.

The potential creator gets added but he/she does not stick in the list. Note: we have a list of 1600+ potential creators and a list of about 120 current creators.

Charlie

In reply to Robert McKerlie

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have managed to reproduce the problem here in Glasgow.

When the course creator logs in their course creator rights are removed when using LDAP. I'm not sure if this is a local problem or related to the 'other' LDAP thread. This is with 1.4.1 by the way.

Anyway - off to get a cup of tea and I will see if I can debug the problem. Watch this space!! smile
In reply to Robert McKerlie

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
OK, got it.... here's the explanation...

The auth_iscreator function in ldap.lib checks if the ldap_creator field in the ldap configuration is empty. If so, it simply returns false. But this is wrong, as false means that the routine has identified that the user is *not* a course creator as opposed to the required response that the creator check could not be made (as no value had been placed in the ldap_creator field).

The authentication routine back in moodlelib.php takes this at face value and deletes the user's creator record.

I think the answer, which I am about to try is to add another function to the auth packages that understand creators to ascertain if the check is possible.

Off to code and test it!!
In reply to Howard Miller

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Ok, here's the fix, line numbers refer to version 1.4.1:

In lib/moodlelib.php in function authenticate_user_login, at line 839, immediately *before*:

if (function_exists('auth_iscreator')

add the following chunk of code:

// check if we can do creator check at all
$creator_possible=true;
if (function_exists('auth_iscreatordefined')) {
$creator_possible=auth_iscreatordefined();
}

The if (function_exists('auth_iscreator') line now needs to be modified slightly to:

       if (function_exists('auth_iscreator') && $creator_possible) {    // Check if the user is a creator

now in auth/ldap/ldap.lib, at or about line 362, in front of auth_iscreator function definition, add the following new function:


function auth_iscreatordefined() {
/// check if ldap_creator and ldap_memberattribute are filled in
/// required to do creator check
return !(($CFG->ldap_creators=="") OR ($CFG->ldap_memberattribute==""));
}

checked and working!!
In reply to Howard Miller

Re: Disappearing Course Creators

by Petri Asikainen -
Thanks to pointing this out.
We could make this work with inside auth_iscreator() with return values "null" ==  not supported,  true == creator   and "false" == not creator. Would it be little bit cleaner that way?

Petri


In reply to Howard Miller

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Just to go on about this some more, it occurs to me that if you just need a quick bodge for now and you don't use LDAP course creators - which you don't or you wouldn't have this problem, change the line in moodlelib

if (function_exists('auth_iscreator')....

to simply

if (false) {

the course creator check will not be made, end of problem.
In reply to Howard Miller

Re: Disappearing Course Creators

by Ger Tielemans -

Moodle will check Course Creators in LDAP and resets it to NO if not found in the LDAP. How to kill this course creator check in LDAP?


Solution by Zbigniew Fiedorowicz - Thursday, 4 December 2003, 04:23 PM

Modify your moodlelib.php (make a backup first!) as follows:

change: if (function_exists('auth_iscreator')) to if(0)


Again a prove that Moodle is missing a good technical FAQ with an index. Would have saved you lot of problems...

I try to document these things for myself, but trust not my technical skills...

In reply to Ger Tielemans

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Ah, well spotted Ger!! Begs the question why it was not fixed properly then??
In reply to Robert McKerlie

Re: Disappearing Course Creators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Bump! (Sorry)

Is somebody going to put this fix or something like it into the 1.4 (or indeed 1.5dev branch)?? We, for one, are having to patch all our sites.

Martin, if you are brave enough to give me CVS access to the auth directories I will sort it myself, but I would really appreciate your comments re. this fix. Is this how you would want to do it, as it adds another method into the auth 'API'?