Name for a new authentication plugin

Name for a new authentication plugin

by Aharon Ben-Shemer -
Number of replies: 2

I want to add a new authentication plugin (Moodle 2.2.2), and I am trying to figure out whether it shoud be named 'auth_xxx' or 'auth/xxx'.

I notice that even plugins follow a naming convention like "auth_xxx", e.g. "auth_db", in their version.php file end up creating settings named 'auth/xxx' as soon as the settings page is saved. I traced this to line 108 of the method print_auth_lock_options in admin/admin_config.php which seems assumes the slash and, I believe, creates settings in mdl_config_plugins accordingly.

What is the "official" standard here? I want to call print_auth_lock_options in my config.html file (to keep it simple), but I also think that the underscore is more officially blessed than the slash. Do I need to clone the print_auth_lock_options method and use my own version? I would be changing only line 108

$pluginconfig = get_config("auth/$auth");

to

$pluginconfig = get_config("auth_$auth");

which seems kind of crazy.

I am also going to post this in the General Development forum.

Thanks,

Aharon

Average of ratings: -
In reply to Aharon Ben-Shemer

Re: Name for a new authentication plugin

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Aharon,

Sorry I can't answer your question, however I'm just going to move your post to the general developer forum, as it's better to post your question in one forum only, as explained in our Moodle.org forums Code of Conduct.

In reply to Aharon Ben-Shemer

Re: Name for a new authentication plugin

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
Hi Aharon,

it's 'auth_$authname' for the plugin name (in version.php, and in the places where you call role_assign/role_unassign() for example), but it's 'auth/$authname' for the plugin configuration settings (and thus in get_config()/set_config())

Saludos.
Iñaki.