New multiple enrolment system

New multiple enrolment system

by Patrick Li -
Number of replies: 12
This feature branch has been developped for a while and I think it is time for some community feedback.

This branch is developped due to the fact that current enrolment plugin system can not allow multiple plugin work at the sametime.

Because of the nature of this branch the enrolment plugin architecture has been changed. All enrolment plugins shipped with moodle official release are modified to meet the new architecture.

I will discuss them here from a user's and a developer's point of view.

If you are an end user:

1. Enrolment admin panel is now enhanced. It now allows you to select multiple plugins you wish to use.
1.1 Internal plugin is always enabled as it is required to do some internal work.
1.2 Enrolment plugins those requires interactive actions with users can be selected as the default interactive plugin for the site.
1.3 Click the "Edit" link on the right side of the plugins to configure them using the origial configuration interface. Don't forget to configure plugins you enabled correctly!
2. There are a few extra options in the course settings.
2.1 You can choose different interactive enrolment plugin from the site default for single courses.
2.2 If you do not want any interactive plugins to be enabled in a course just set "Enrollable" setting in the course to "No". Non-interactive ones will still work.


If you are a developer:

As mentioned above this branch changed the enrolment plugin API. So some detailed explaination is avaiable as below:

1. Changes to the enrolment plugin class structure:
1.1 There are no base class any more. All enrolment plugins are independent classes.
1.2 The origial base class is now the internal plugin class.
1.3 A new enrolment_factory class is introduced to produce enrolment plugins required. Should an instance of any plugin is required, use

$plugin = enrolment_factory::factory('plugin_name');

If plugin_name is not specified the default plugin for the site will be created.
1.4 If any enrolment plugin does not implement print_entry() method it will be considered as a non-interactive plugin. In the new plugin configuration panel only interactive plugins will be able to set as default plugin. As non-interactive plugins will load student/teacher information everytime user is logged in and when user is attempting to enrol to a course, it is meanless to set them as the "gate" of a course.
1.5 If any method in the internal class is required just factory an instance of internal plugin and call the required method.
2. Setting "Enrollable" to "No" in a course will disable users to enrol interactively. So it is fine to leave internal plugin always enabled and as the default way of enrolling.
3. Enabled plugins are stored as a comma-seperated list in config varaible enrol_plugins_enabled. It is ensured that internal plugin is always at the top of the list so it will produce a complete user-course array for the rest of the plugins to use.
4. The old $CFG->enrol is used to store the default site interactive plugin. It may be empty as there is a block of code that if $CFG->enrol is empty, populate it with 'internal', which is exactly what we want.
5. A new field called "enrol" is added to course table storing the plugin that the course uses. If it is empty, site default will be used.
6. The upgrade script will try to figure out whether your current enrolment plugin is interactive or not. If not, "Enrollable" option for all courses will be set to "No".
7. The interal get_student_courses() method will populate the user-course array in a slightly different way. A boolean value of true indicating the user is enrolled to a course is now replaced by a string of the name of the enrolment plugin that enrolled this user to the course. In this way there are no need to query database to ask if the user is enrolled by a particular plugin when trying to unenrol a user. Also this may be used to prevent a plugin to mess up with users enrolled by another plugin.


There might be something that I didn't cover, if you have any questions/comments/suggestions/whatever please feel free to reply.

Just in case you don't know how, to get a copy of this feature branch use the following cvs command:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/moodle checkout -r MOODLE_16_MULTIENROL moodle
Average of ratings: -
In reply to Patrick Li

Re: New multiple enrolment system

by Shane Elliott -
Picture of Core developers Picture of Plugin developers
Hey Patrick, no comments to make yet. Just wanted to say great job to you et al. This is a v cool addition!
In reply to Patrick Li

Re: New multiple enrolment system

by Dan Stowell -
Eek - my IMS enrolment module will need to change significantly then...? mixed

We're staying with Moodle 1.5 for a while so the transition won't occur for a while.
In reply to Dan Stowell

Re: New multiple enrolment system

by Martín Langhoff -
Dan -- the changes aren't too serious, and definitely worth it. If you are having problems with the transition, we'll be happy to help.
In reply to Martín Langhoff

Re: New multiple enrolment system

by Dan Stowell -
Thanks Martin. I might manage OK... wink - I'm just wondering about timing. I'd be very happy if I could get the IMS enrolment included in the main distribution of 1.6, but it might be more straightforward to wait until after 1.6 is out, and get it ready it for 1.6.1...

Does anyone have an ETA for 1.6 yet?
In reply to Dan Stowell

Re: New multiple enrolment system

by Martín Langhoff -
No, dates really other than a general desire to freeze/branch/release February-ish (if I understood MartinD right). But the code is in CVS already. It is a branch called MOODLE_16_MULTI_ENROL or something like that. We are planning to land it on HEAD soonish.

In any case, we'll be happy to help the port to the 1.6. The changes aren't many...

In reply to Patrick Li

Re: New multiple enrolment system

by Robert Brenstein -
I am currently troubleshooting login/authentication problems at our site and discovered (with horror) that there are branches of login code that abort the login procedure without a differentiating error to the user or entry into the log. I mean that the generic error that authentication failed is displayed not only when the (external) athentication really fails. I hope the new code will clean this up.

There is some error lurking in Moodle (1.5.2+ at least) when new Moodle users are trying to login, but I don't know enough yet to point fingers. Some can but some can't log in. However, once they are in mdl_users, all have no problem logging in.
In reply to Robert Brenstein

Re: New multiple enrolment system

by Martín Langhoff -

Is this related to the new multiple enrolment system -- which is only on a CVS branch or from HEAD?

If you do find a concrete bug, do let us know, but we'll need a good amount of detail. If it is related to authentication, there user authentication forum is the place to discuss it...

In reply to Martín Langhoff

Re: New multiple enrolment system

by Robert Brenstein -
I am sorry, I think I misread what multienrolment is about. I construed it to be multiauthentication, that is applying to login stage not course enrolment stage.

The code I mentioned is a working code in the 1.5.x Moodle but deficiently coded IMHO. I will just enter this into bugtracker since I have no clue which forum applies.
In reply to Patrick Li

Re: New multiple enrolment system

by Dan Stowell -
Patrick/Martin -

I downloaded this branch and tried to adapt my IMS-Enterprise code for it. It seems to work fine! It's attached. I did the adapting by copying the changes that were applied to the flatfile plugin.

There may be issues still to work on with the IMS-E plugin so I'm a little nervous at starting to have two versions (one for 1.5 and one for 1.6) that I need to keep both up-to-date...

Comments welcome. As Martin has mentioned in another thread, the "coursealias" feature of my plugin should really be generic to enrolments, not just to IMS enrolments. Are you willing to entertain that idea, or would you rather remove the feature entirely before adding it to the 1.6 branch?

Dan
In reply to Dan Stowell

Re: New multiple enrolment system

by Martín Langhoff -
Good stuff. I'm a bit too busy in the run up to xmas to be able to review the code in full right now sad but I'll take a look at it after the break.

WRT course alias... I'm not sure. I wonder if MD is reading, as I'd like to hear his opinion.

I suspect we should write a core coursealias implementation but I can't find the time!
In reply to Martín Langhoff

Re: New multiple enrolment system

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
I don't know if this is related to this 'coursealias' thing (I can't find a definition of it in the forums clear enough), but are there any plans to make a course belong to more than one category?

That could be useful in our setup.

Saludos. Iñaki.