Commit 25850d45 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

view: Prevent view submission to oneself (bug #632308)



If there are no other people with view assessment permission in the group,
the view can't be submitted.
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent bc84fa4e
...@@ -1377,7 +1377,7 @@ function group_get_user_course_groups($userid=null) { ...@@ -1377,7 +1377,7 @@ function group_get_user_course_groups($userid=null) {
global $USER; global $USER;
$userid = $USER->get('id'); $userid = $USER->get('id');
} }
if ($groups = get_records_sql_array( if ($groups = get_records_sql_assoc(
"SELECT g.id, g.name "SELECT g.id, g.name
FROM {group_member} u FROM {group_member} u
INNER JOIN {group} g ON (u.group = g.id AND g.deleted = 0) INNER JOIN {group} g ON (u.group = g.id AND g.deleted = 0)
...@@ -1386,6 +1386,11 @@ function group_get_user_course_groups($userid=null) { ...@@ -1386,6 +1386,11 @@ function group_get_user_course_groups($userid=null) {
AND t.submittableto = 1 AND t.submittableto = 1
ORDER BY g.name ORDER BY g.name
", array($userid))) { ", array($userid))) {
foreach (array_keys($groups) as $key) {
if (!count(group_get_members_can_see_submitted_views($key))) {
unset($groups[$key]);
}
}
return $groups; return $groups;
} }
return array(); return array();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment