From 0775756551bc7110f0add2e6f64fd4d84cabc94e Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Fri, 10 Feb 2023 13:57:02 +0000 Subject: [PATCH] MDL-68093 assign: Restrict group submission to participation groups --- mod/assign/locallib.php | 2 +- mod/assign/override_form.php | 2 +- .../tests/behat/group_submission.feature | 30 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 8496e16e8b6..91278aab335 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3345,7 +3345,7 @@ class assign { } $grouping = $this->get_instance()->teamsubmissiongroupingid; - $return = groups_get_all_groups($this->get_course()->id, $userid, $grouping); + $return = groups_get_all_groups($this->get_course()->id, $userid, $grouping, 'g.*', false, true); $this->usergroups[$userid] = $return; diff --git a/mod/assign/override_form.php b/mod/assign/override_form.php index d0990eb59fb..3c6620988cb 100644 --- a/mod/assign/override_form.php +++ b/mod/assign/override_form.php @@ -128,7 +128,7 @@ class assign_override_form extends moodleform { $groupchoices = array(); foreach ($groups as $group) { - if ($group->visibility != \core_group\visibility::NONE) { + if ($group->visibility != GROUPS_VISIBILITY_NONE) { $groupchoices[$group->id] = format_string($group->name, true, $this->context); } } diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index 93325c17931..cef833e5e39 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -385,3 +385,33 @@ Feature: Group assignment submissions And I am on the "Assign 2" "assign activity" page logged in as student2 And I should see "Submitted for grading" in the "Submission status" "table_row" And I should not see "Users who need to submit" + + Scenario: Group submission does not use non-participation groups + Given the following "courses" exist: + | fullname | shortname | category | groupmode | + | Course 1 | C1 | 0 | 1 | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + | student1 | Student | 1 | student0@example.com | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And the following "groups" exist: + | name | course | idnumber | participation | + | Group 1 | C1 | G1 | 0 | + And the following "group members" exist: + | group | user | + | G1 | student1 | + And the following "activity" exists: + | activity | assign | + | course | C1 | + | name | Test assignment name | + | intro | Test assignment description | + | submissiondrafts | 0 | + | teamsubmission | 1 | + | groupmode | 1 | + When I am on the "Test assignment name" Activity page logged in as student1 + Then I should see "Default group" + And I should not see "Group 1"