]> git.mjollnir.org Git - moodle.git/commitdiff
moodlelib: require_login() - assign tempguest role using load_temp_role()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:16:43 +0000 (07:16 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:16:43 +0000 (07:16 +0000)
And remove the explicit handling of deprecated $USER->capabilities

lib/moodlelib.php

index 8cd475b25d5c501222fc0d768ffe07406da73b76..82342ade81ae59205bbb53775e65a25a8a9de57e 100644 (file)
@@ -1784,9 +1784,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
         if ($USER->username != 'guest' and !has_capability('moodle/course:view', $context)) {
             if ($COURSE->guest == 1) {
                  // Temporarily assign them guest role for this context, if it fails later user is asked to enrol
-                 has_capability('clearcache');   // Must clear cache
-                 $guestcaps = get_role_context_caps($CFG->guestroleid, $context);
-                 $USER->capabilities = merge_role_caps($USER->capabilities, $guestcaps);
+                 $USER->access = load_temp_role($context, $CFG->guestroleid, $USER->access);
             }
         }