Changing a user's authentication plugin automatically/transparently

Changing a user's authentication plugin automatically/transparently

by Philip Norton -
Number of replies: 0

Hi all,

I have a reasonably complex setup when it comes to authentication. We use DB enrolment and DB authentication on our server to allow our pupils' parents to authenticate to Moodle and be automatically enrolled in the correct courses (as guests) using our SIS database as the starting point. Staff and pupils authenticate to Moodle using the Active Directory plugin.

All this essentially means managing authentication in two places and since we spend a lot of time in the SIS, I figured writing a plugin so that Moodle can use that as a single point of reference and exploit the SIS login API that is available.

My login plugin is working. I can authenticate as expected in Moodle using the SIS as the authentication authority.

However, all these users now have their user accounts (`mdl_user`.`auth`) set to use DB or AD authentication plugins. Of course, if I disable those plugins, then they lose their logins.

Is there a way that I can update their login details to use my new plugin if it recognises their username? Would I do this using a login hook? I can't find any worked examples on this.

I realise that I could simply update the database but I'd like to make this available to other schools using our SIS and not all their Moodle administrators are as happy digging around in the Moodle database as I am.

Average of ratings: -