Skip to content

Commit

Permalink
Merge pull request from GHSA-j3gf-rm9h-mqvf
Browse files Browse the repository at this point in the history
bugfix: fix capability check for guests
  • Loading branch information
Peterburnett authored Feb 17, 2023
2 parents ae6413f + db06a13 commit c511822
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ public static function require_auth($courseorid = null, $autologinguest = null,
$setwantsurltome = null, $preventredirect = null) {
global $PAGE, $SESSION, $FULLME;

// Guest user should never interact with MFA,
// And $SESSION->tool_mfa_authenticated should never be set in a guest session.
if (isguestuser()) {
return;
}

if (!self::is_ready()) {
// Set session var so if MFA becomes ready, you dont get locked from session.
$SESSION->tool_mfa_authenticated = true;
Expand Down Expand Up @@ -685,7 +691,7 @@ public static function is_ready() {

// Check if user can interact with MFA.
$usercontext = \context_user::instance($USER->id);
if (!has_capability('tool/mfa:mfaaccess', $usercontext, $USER)) {
if (!has_capability('tool/mfa:mfaaccess', $usercontext)) {
return false;
}

Expand Down

0 comments on commit c511822

Please sign in to comment.