Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion local/o365/classes/feature/cohortsync/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ public function get_group_owners_and_members(string $groupoid) {
return false;
}

$excludeowners = (bool) get_config('local_o365', 'cohortsync_excludeowners');

try {
$memberrecords = $this->graphclient->get_transitive_group_members($groupoid);
$ownerrecords = $this->graphclient->get_group_owners($groupoid);
$ownerrecords = $excludeowners ? [] : $this->graphclient->get_group_owners($groupoid);
} catch (moodle_exception $e) {
if (strpos($e->getMessage(), utils::RESOURCE_NOT_EXIST_ERROR) !== false) {
$DB->delete_records('local_o365_objects', ['objectid' => $groupoid]);
Expand Down
2 changes: 2 additions & 0 deletions local/o365/lang/en/local_o365.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
$string['settings_cohortsync_linktext'] = 'Manage Cohort sync';
$string['settings_cohortsync_details'] = 'Review and manage synchronization between Moodle Cohorts and Microsoft Groups.';
$string['settings_cohortsync_title'] = 'Cohort sync';
$string['settings_cohortsync_excludeowners'] = 'Exclude group owners from cohort sync';
$string['settings_cohortsync_excludeowners_desc'] = 'When enabled, only group members are synchronised to Moodle cohorts. Group owners are excluded. Existing cohort members who are owners will be removed on the next sync run.';

// Settings in the "Team / group names" section of the "Sync settings" tab.
$string['settings_secthead_team_group_name'] = 'Team / group names';
Expand Down
4 changes: 4 additions & 0 deletions local/o365/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@
$desc
));

$label = new lang_string('settings_cohortsync_excludeowners', 'local_o365');
$desc = new lang_string('settings_cohortsync_excludeowners_desc', 'local_o365');
$syncsettings->add(new admin_setting_configcheckbox('local_o365/cohortsync_excludeowners', $label, $desc, '0'));

// Course request section.
$label = new lang_string('settings_secthead_course_request', 'local_o365');
$desc = new lang_string('settings_secthead_course_request_desc', 'local_o365');
Expand Down