MDL-57362 assign: Fix permission checks
authorAnkit Agarwal <ankit@moodle.com>
Tue, 7 Mar 2017 07:13:30 +0000 (12:43 +0530)
committerAnkit Agarwal <ankit@moodle.com>
Tue, 7 Mar 2017 07:13:30 +0000 (12:43 +0530)
mod/assign/locallib.php

index af2ff92..5a54640 100644 (file)
@@ -3096,7 +3096,8 @@ class assign {
         }
         // 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()));
+            $groupflag = has_capability('moodle/site:accessallgroups', $this->get_context());
+            $groupflag = $groupflag || !empty(groups_get_activity_allowed_groups($this->get_course_module()));
             return (bool)$groupflag;
         }
         return true;