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

This commit is contained in:
skodak 2008-02-18 23:34:38 +00:00
parent 93964e1aeb
commit 5f431c1bad

View File

@ -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