From 5f431c1bad0ea58fdbef71b82299fd03ba7a99c1 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 18 Feb 2008 23:34:38 +0000 Subject: [PATCH] MDL-12382 allow admins to access any course - including courses where they have guest role and course does not allow guests; merged from MOODLE_19_STABLE --- lib/moodlelib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 5c89fc35bb..37abbaa816 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1957,6 +1957,11 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) { /// If the user is a guest then treat them according to the course policy about guests if (has_capability('moodle/legacy:guest', $COURSE->context, NULL, false)) { + if (has_capability('moodle/site:doanything', $sysctx)) { + // administrators must be able to access any course - even if somebody gives them guest access + return true; + } + switch ($COURSE->guest) { /// Check course policy about guest access case 1: /// Guests always allowed -- 2.39.5