From f445fb8fa18fd163159e247504d29b225cb7aa9a Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Thu, 12 Jan 2017 15:56:40 +0530 Subject: [PATCH 1/2] MDL-57362 assignlib: Check for sep groups edge case --- mod/assign/locallib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index ae287f06666..9442b34f554 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3094,7 +3094,11 @@ class assign { if (!has_any_capability(array('mod/assign:viewgrades', 'mod/assign:grade'), $this->context)) { return false; } - + // Checks for the edge case when user belongs to no groups and groupmode is sep. + if ($this->get_course_module()->effectivegroupmode == SEPARATEGROUPS) { + $groupflag = !empty(groups_get_activity_allowed_groups($this->get_course_module())); + return (bool)$groupflag; + } return true; } From ca09e2157b4f96815c11aed851ffd4c843765c89 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Tue, 24 Jan 2017 17:42:40 +0530 Subject: [PATCH 2/2] MDL-57362 assignlib: Fix minor bug in phpdocs --- mod/assign/locallib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 9442b34f554..af2ff926427 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3064,7 +3064,7 @@ class assign { * Throw an error if the permissions to view this users submission are missing. * * @throws required_capability_exception - * @return none + * @return void */ public function require_view_submission($userid) { if (!$this->can_view_submission($userid)) { @@ -3076,7 +3076,7 @@ class assign { * Throw an error if the permissions to view grades in this assignment are missing. * * @throws required_capability_exception - * @return none + * @return void */ public function require_view_grades() { if (!$this->can_view_grades()) {