MDL-56363 mod_assign: Restrictions added for tutors.
authorAdrian Greeve <adrian@moodle.com>
Wed, 2 Nov 2016 05:56:16 +0000 (13:56 +0800)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 10 Nov 2016 23:28:33 +0000 (00:28 +0100)
If the grader does not have the accessallgroups capability,
or groups mode is set to separate groups and the user is not
a member of the group then no participants are shown.

mod/assign/amd/build/participant_selector.min.js
mod/assign/amd/src/participant_selector.js
mod/assign/externallib.php

index 23a7ce5..c5b0452 100644 (file)
Binary files a/mod/assign/amd/build/participant_selector.min.js and b/mod/assign/amd/build/participant_selector.min.js differ
index f92f4fb..f03466c 100644 (file)
@@ -54,6 +54,7 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
          */
         transport: function(selector, query, success, failure) {
             var assignmentid = $(selector).attr('data-assignmentid');
+            var groupid = $(selector).attr('data-groupid');
             var filters = $('[data-region="configure-filters"] input[type="checkbox"]');
             var filterstrings = [];
 
@@ -63,7 +64,7 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
 
             var promise = ajax.call([{
                 methodname: 'mod_assign_list_participants',
-                args: {assignid: assignmentid, groupid: 0, filter: query, limit: 30, includeenrolments: false}
+                args: {assignid: assignmentid, groupid: groupid, filter: query, limit: 30, includeenrolments: false}
             }]);
 
             promise[0].then(function(results) {
index e075e88..cd52c57 100644 (file)
@@ -2568,7 +2568,10 @@ class mod_assign_external extends external_api {
 
         $assign->require_view_grades();
 
-        $participants = $assign->list_participants_with_filter_status_and_group($params['groupid']);
+        $participants = array();
+        if (groups_group_visible($params['groupid'], $course, $cm)) {
+            $participants = $assign->list_participants_with_filter_status_and_group($params['groupid']);
+        }
 
         $userfields = user_get_default_fields();
         if (!$params['includeenrolments']) {