Blame view

sources/settings/ajax/excludegroups.php 649 Bytes
6d9380f96   Cédric Dupont   Update sources OC...
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));