}
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-$usercontext = get_context_instance(CONTEXT_PERSONAL, $user->id);
+$usercontext = get_context_instance(CONTEXT_USER, $user->id);
require_capability('gradereport/overview:view', $context);
$access = true;
} else if ($user->id == $USER->id and has_capability('moodle/grade:view', $context) and $course->showgrades) {
//ok - can view own grades
-} else if (has_capability('moodle/grade:view', $usercontext) and $course->showgrades) {
+} else if (has_capability('moodle/grade:viewall', $usercontext) and $course->showgrades) {
// ok - can view grades of this user- parent most probably
} else {
}
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-$usercontext = get_context_instance(CONTEXT_PERSONAL, $user->id);
+$usercontext = get_context_instance(CONTEXT_USER, $user->id);
require_capability('gradereport/user:view', $context);
$access = true;
} else if ($user->id == $USER->id and has_capability('moodle/grade:view', $context) and $course->showgrades) {
//ok - can view own grades
-} else if (has_capability('moodle/grade:view', $usercontext) and $course->showgrades) {
+} else if (has_capability('moodle/grade:viewall', $usercontext) and $course->showgrades) {
// ok - can view grades of this user- parent most probably
} else {
'moodle/grade:viewall' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
- 'contextlevel' => CONTEXT_COURSE,
+ 'contextlevel' => CONTEXT_COURSE, // and CONTEXT_USER
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'moodle/grade:view' => array(
'captype' => 'read',
- 'contextlevel' => CONTEXT_COURSE, // and CONTEXT_PERSONAL too
+ 'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW
)
'moodle/grade:viewhidden' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
- 'contextlevel' => CONTEXT_COURSE, // and CONTEXT_PERSONAL too
+ 'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,