mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Revert "MDL-35556 completion: Improve user completion data permission checking"
This reverts commit f493d528c2
.
This commit is contained in:
parent
d2dc4c4551
commit
cd1a9d05e8
3 changed files with 19 additions and 75 deletions
|
@ -46,9 +46,25 @@ if ($userid) {
|
|||
|
||||
|
||||
// Check permissions
|
||||
require_login();
|
||||
require_login($course);
|
||||
|
||||
if (!completion_can_view_data($user->id, $course)) {
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$personalcontext = context_user::instance($user->id);
|
||||
|
||||
$can_view = false;
|
||||
|
||||
// Can view own report
|
||||
if ($USER->id == $user->id) {
|
||||
$can_view = true;
|
||||
} else if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext)) {
|
||||
$can_view = true;
|
||||
} else if (has_capability('report/completion:view', $coursecontext)) {
|
||||
$can_view = true;
|
||||
} else if (has_capability('report/completion:view', $personalcontext)) {
|
||||
$can_view = true;
|
||||
}
|
||||
|
||||
if (!$can_view) {
|
||||
print_error('cannotviewreport');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue