Merge pull request #19510 from owncloud/json-grouplist-sharing-exclude
save excluded groups in json format
This commit is contained in:
commit
8944cb539e
|
@ -223,7 +223,12 @@ class OC_Util {
|
|||
if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
|
||||
$user = \OCP\User::getUser();
|
||||
$groupsList = \OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups_list', '');
|
||||
$excludedGroups = explode(',', $groupsList);
|
||||
$excludedGroups = json_decode($groupsList);
|
||||
if (is_null($excludedGroups)) {
|
||||
$excludedGroups = explode(',', $groupsList);
|
||||
$newValue = json_encode($excludedGroups);
|
||||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', $newValue);
|
||||
}
|
||||
$usersGroups = \OC_Group::getUserGroups($user);
|
||||
if (!empty($usersGroups)) {
|
||||
$remainingGroups = array_diff($usersGroups, $excludedGroups);
|
||||
|
|
|
@ -87,7 +87,7 @@ $template->assign('shareEnforceExpireDate', $appConfig->getValue('core', 'sharea
|
|||
$excludeGroups = $appConfig->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
|
||||
$template->assign('shareExcludeGroups', $excludeGroups);
|
||||
$excludedGroupsList = $appConfig->getValue('core', 'shareapi_exclude_groups_list', '');
|
||||
$excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON!
|
||||
$excludedGroupsList = json_decode($excludedGroupsList);
|
||||
$template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
|
||||
$template->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled());
|
||||
$backends = \OC::$server->getUserManager()->getBackends();
|
||||
|
|
|
@ -23,11 +23,7 @@ $(document).ready(function(){
|
|||
OC.Settings.setupGroupsSelect($(element));
|
||||
$(element).change(function(ev) {
|
||||
var groups = ev.val || [];
|
||||
if (groups.length > 0) {
|
||||
groups = ev.val.join(','); // FIXME: make this JSON
|
||||
} else {
|
||||
groups = '';
|
||||
}
|
||||
groups = JSON.stringify(groups);
|
||||
OC.AppConfig.setValue('core', $(this).attr('name'), groups);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -303,7 +303,7 @@ class Test_Util extends \Test\TestCase {
|
|||
}
|
||||
|
||||
$appConfig = \OC::$server->getAppConfig();
|
||||
$appConfig->setValue('core', 'shareapi_exclude_groups_list', implode(',', $excludedGroups));
|
||||
$appConfig->setValue('core', 'shareapi_exclude_groups_list', json_encode($excludedGroups));
|
||||
$appConfig->setValue('core', 'shareapi_exclude_groups', 'yes');
|
||||
|
||||
$result = \OCP\Util::isSharingDisabledForUser();
|
||||
|
|
Loading…
Reference in New Issue