MDL-74075 core_badges: Check accepted criterias

This commit is contained in:
Amaia Anabitarte 2022-03-07 13:27:39 +01:00 committed by Sara Arjona
parent bf842246c6
commit c36ab09b66

View File

@ -55,6 +55,12 @@ if ($badge->is_active() || $badge->is_locked()) {
redirect($return);
}
// Make sure the criteria type is accepted.
$accepted = $badge->get_accepted_criteria();
if (!in_array($type, $accepted)) {
redirect($return);
}
if ($badge->type == BADGE_TYPE_COURSE) {
require_login($badge->courseid);
$course = get_course($badge->courseid);