summaryrefslogtreecommitdiffstats
path: root/settings/ajax/excludegroups.php
blob: 2934a448a6ae4bb967f56231b99c97835d2724d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();

$selectedGroups = isset($_POST["selectedGroups"]) ? json_decode($_POST["selectedGroups"]) : array();
$changedGroup = isset($_POST["changedGroup"]) ? $_POST["changedGroup"] : '';

if ($changedGroup !== '') {
	if(($key = array_search($changedGroup, $selectedGroups)) !== false) {
		unset($selectedGroups[$key]);
	} else {
		$selectedGroups[] = $changedGroup;
	}
} else {
	\OCP\Util::writeLog('core', 'Can not update list of excluded groups from sharing, parameter missing', \OCP\Util::WARN);
}

\OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', implode(',', $selectedGroups));