diff --git a/manage.php b/manage.php index 830c61f..27709d6 100644 --- a/manage.php +++ b/manage.php @@ -39,12 +39,18 @@ $att = $DB->get_record('attendance', array('id' => $cm->instance), '* require_login($course, true, $cm); -$pageparams->init($cm); -$att = new attendance($att, $cm, $course, $PAGE->context, $pageparams); -if (!$att->perm->can_manage() && !$att->perm->can_take() && !$att->perm->can_change()) { +$capabilities = array( + 'mod/attendance:manageattendances', + 'mod/attendance:takeattendances', + 'mod/attendance:changeattendances' +); +if (!has_any_capability($capabilities, $PAGE->context)) { redirect($att->url_view()); } +$pageparams->init($cm); +$att = new attendance($att, $cm, $course, $PAGE->context, $pageparams); + // If teacher is coming from block, then check for a session exists for today. if ($from === 'block') { $sessions = $att->get_today_sessions();