Skip to content

Commit

Permalink
moodlelib: require_login() - assign tempguest role using load_temp_ro…
Browse files Browse the repository at this point in the history
…le()

And remove the explicit handling of deprecated $USER->capabilities
  • Loading branch information
martinlanghoff committed Sep 19, 2007
1 parent 343effb commit 955679b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/moodlelib.php
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 955679b

Please sign in to comment.