enrolment hierarchy, manual trumping all others

enrolment hierarchy, manual trumping all others

by Scott Krajewski -
Number of replies: 7
This is something I've been struggling with since 1.6 when IMS appeared. I've hacked 1.6 to work the way I want, but now I'm setting up 1.8.3 and don't want to hack it.

What I want is manual enrolment to trump IMS Enrolment. Or else for enrolment methods not to overwrite each other. We've had several cases where using IMS Enrolment a student added then dropped a class then added it again (in our registration system). All 3 of these events come through in the IMS file I generate. So said student is continually added, dropped, and added to the course. In 1.6 this dropped them from their groups. My workaround was to change IMS Enrolment to not unenrol if it saw a student as being enrolled by a method other than IMS. That way we could manually add them and they'd stay.

Does it seem like I should just generate the IMS file differently -- taking only the last event instead of all events? I've been staring at this too closely and am looking for a fresh perspective.

IMS Enrolment is awesome btw,

-- Scott


Average of ratings: -
In reply to Scott Krajewski

Re: enrolment hierarchy, manual trumping all others

by Martín Langhoff -

Hi Scott!

That sounds like a bug. Each enrolment plugin deals with its "own" enrolments, and should not remove enrolments handled by other plugins. IOWs...

  • When looking at "what to add" it should look at all enrolments. If there's already an enrolment handled by other plugin, then it should do nothing.
  • When looking at "what to remove" it should strictly look at enrolments with an 'enrol' field of 'imsenterprise'.

That's what other enrolments (LDAP, Database) do.

In reply to Martín Langhoff

Re: enrolment hierarchy, manual trumping all others

by Scott Krajewski -
Thanks Martin. I haven't tested yet with 1.8.x and the new roles. So it might not be bugworthy. I was projecting my 1.6 experience forward. I'll do some testing with 1.8.x and see how it goes. I'm still getting used to looking at the role PHP code (we skipped 1.7 so this is my first look at it)!

-- Scott
In reply to Martín Langhoff

Re: enrolment hierarchy, manual trumping all others

by Scott Krajewski -
Just tested it Martin. I have a basic XML file, 1 course, 1 teacher, 1 student. I enrolled them. I then changed the XML file to mark the student as a drop, status 0, and re-ran. It removed him (which is what I'd expect).

I then manually added him into the course. And then re-ran the XML file. He's gone now. Uh-oh.

bugtracker you think?

-- Scott
In reply to Scott Krajewski

Re: enrolment hierarchy, manual trumping all others

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes, it is definitely a bug. I've had a look at the code and it unconditionally unenrols users when they are marked as a drop, without looking at the 'owner' of the enrolment (manual, database, etc.).

Could you please post a note here with the bug number when you file it?

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: enrolment hierarchy, manual trumping all others

by Scott Krajewski -
I've logged it. http://tracker.moodle.org/browse/MDL-12783

Bug # 12783

-- Scott
In reply to Scott Krajewski

Re: enrolment hierarchy, manual trumping all others

by Scott Krajewski -
I found the fix for 1.9.1 and updated my bugtracker entry.


enrol/imsenterprise/enrol.php
line 824
from
if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext,)) {

to
if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext,'imsenterprise')) {

No method was specified so the function role_unassign assumes null which means any which means remove them no matter what.
 Scott Krajewski - 03/Jun/08 05:21 AM I found the fix for 1.9.1. enrol/imsenterprise/enrol.php line 824 from if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext,)) { to if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext,'imsenterprise')) { No method was specified so the function role_unassign assumes null which means any which means remove them no matter what.

In reply to Scott Krajewski

Re: enrolment hierarchy, manual trumping all others

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Fixed in 1.8, 1.9 and HEAD current as of today.

Thanks a lot for the bug report and the fix! smile

Saludos. Iñaki.