MDL-80268 badges: require capability to view awarded badges.

This commit is contained in:
Paul Holden 2023-11-27 20:35:33 +00:00 committed by Jenkins
parent 0f3e5df4b5
commit c564a8249a

View File

@ -54,6 +54,8 @@ $badge = new badge($badgeid);
$context = $badge->get_context(); $context = $badge->get_context();
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type)); $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
require_capability('moodle/badges:viewawarded', $context);
if ($badge->type == BADGE_TYPE_COURSE) { if ($badge->type == BADGE_TYPE_COURSE) {
if (empty($CFG->badges_allowcoursebadges)) { if (empty($CFG->badges_allowcoursebadges)) {
throw new \moodle_exception('coursebadgesdisabled', 'badges'); throw new \moodle_exception('coursebadgesdisabled', 'badges');