MDL-80612 auth: Allow plugins to identify Moodle users on the CLI

This commit is contained in:
Brendan Heywood
2024-03-27 21:58:04 +11:00
parent c895def59b
commit 2d286ef8f8
5 changed files with 170 additions and 0 deletions
+5
View File
@@ -1027,6 +1027,11 @@ if (!empty($CFG->debugvalidators) and !empty($CFG->guestloginbutton)) {
// can be using in the logfile and stripped out if needed.
set_access_log_user();
if (CLI_SCRIPT && !empty($CFG->version)) {
// Allow auth plugins to optionally authenticate users on the CLI.
require_once($CFG->libdir. '/authlib.php');
auth_plugin_base::login_cli_admin_user();
}
// Ensure the urlrewriteclass is setup correctly (to avoid crippling site).
if (isset($CFG->urlrewriteclass)) {