Skip to content

Commit

Permalink
MBS-9220: Respect forcegroupmode
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Jun 24, 2024
1 parent 83566f0 commit 043957d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions classes/external/get_kanban_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,10 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool

$kanbanboard->heading = get_string('courseboard', 'mod_kanban');
$groupselector = null;
$groupmode = groups_get_activity_groupmode($cminfo, $course);

if (!$asupdate) {
if (!empty($cminfo->groupmode)) {
if (!empty($groupmode)) {
$groupselector = groups_print_activity_menu(
$cminfo,
new \moodle_url('/mod/kanban/view.php', ['id' => $cminfo->id]),
Expand Down Expand Up @@ -432,11 +433,11 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool
return intval($v->id);
}, $members);
$ismember = in_array($USER->id, $members);
if ($cminfo->groupmode == SEPARATEGROUPS && !$ismember) {
if ($groupmode == SEPARATEGROUPS && !$ismember) {
require_capability('mod/kanban:viewallboards', $context);
$restrictcaps = true;
}
if ($cminfo->groupmode == VISIBLEGROUPS && !$ismember) {
if ($groupmode == VISIBLEGROUPS && !$ismember) {
$restrictcaps = true;
}
}
Expand All @@ -457,7 +458,7 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool
$common->lang = str_replace('_', '-', $common->lang);
$common->liveupdate = get_config('mod_kanban', 'liveupdatetime');
$common->userboards = $kanban->userboards;
$common->groupmode = $cminfo->groupmode;
$common->groupmode = $groupmode;
$common->groupselector = $groupselector;
$common->history = $kanban->history;

Expand Down
5 changes: 3 additions & 2 deletions classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ public static function check_permissions_for_user_or_group(
return intval($v->id);
}, $members);
$ismember = in_array($USER->id, $members);
if ($cminfo->groupmode == SEPARATEGROUPS && !$ismember) {
$groupmode = groups_get_activity_groupmode($cminfo, $cminfo->course);
if ($groupmode == SEPARATEGROUPS && !$ismember) {
require_capability(constants::MOD_KANBAN_CAPABILITY[$type], $context);
}
if ($cminfo->groupmode == VISIBLEGROUPS && !$ismember && $type == constants::MOD_KANBAN_EDIT) {
if ($groupmode == VISIBLEGROUPS && !$ismember && $type == constants::MOD_KANBAN_EDIT) {
require_capability(constants::MOD_KANBAN_CAPABILITY[$type], $context);
}
}
Expand Down
4 changes: 3 additions & 1 deletion view.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
$groupselector = '';
$groupid = 0;

if (!empty($cm->groupmode) && $group != 0) {
$groupmode = groups_get_activity_groupmode($cm, $course);

if (!empty($groupmode) && $group != 0) {
$groupid = groups_get_activity_group($cm, true);
}

Expand Down

0 comments on commit 043957d

Please sign in to comment.