Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDL-27508 workshop checks separate groups membership when displaying …
…an assessment
  • Loading branch information
mudrd8mz committed Apr 27, 2012
1 parent f65bc55 commit 3f5e991
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mod/workshop/assessment.php
Expand Up @@ -63,6 +63,21 @@
$isreviewer = ($USER->id == $assessment->reviewerid);
$isauthor = ($USER->id == $submission->authorid);

if ($canviewallsubmissions) {
// check this flag against the group membership yet
if (groups_get_activity_groupmode($workshop->cm) == SEPARATEGROUPS) {
// user must have accessallgroups or share at least one group with the submission author
if (!has_capability('moodle/site:accessallgroups', $workshop->context)) {
$usersgroups = groups_get_activity_allowed_groups($workshop->cm);
$authorsgroups = groups_get_all_groups($workshop->course->id, $submission->authorid, $workshop->cm->groupingid, 'g.id');
$sharedgroups = array_intersect_key($usersgroups, $authorsgroups);
if (empty($sharedgroups)) {
$canviewallsubmissions = false;
}
}
}
}

if ($isreviewer or $isauthor or ($canviewallassessments and $canviewallsubmissions)) {
// such a user can continue
} else {
Expand Down

0 comments on commit 3f5e991

Please sign in to comment.