From e89ed4b46330a4ffacec160623aa233c3ef25989 Mon Sep 17 00:00:00 2001 From: Noemie Ariste Date: Wed, 21 Dec 2022 17:41:53 +1300 Subject: [PATCH] MDL-60038 moodlelib: ignore site policy if user auth type = 'webservice' --- lib/moodlelib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d22c8dad008..e7b9c901f82 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2899,7 +2899,8 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $ // Check that the user has agreed to a site policy if there is one - do not test in case of admins. // Do not test if the script explicitly asked for skipping the site policies check. - if (!$USER->policyagreed && !is_siteadmin() && !NO_SITEPOLICY_CHECK) { + // Or if the user auth type is webservice. + if (!$USER->policyagreed && !is_siteadmin() && !NO_SITEPOLICY_CHECK && $USER->auth !== 'webservice') { $manager = new \core_privacy\local\sitepolicy\manager(); if ($policyurl = $manager->get_redirect_url(isguestuser())) { if ($preventredirect) {