aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-01 15:37:55 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-01 15:37:55 +0200
commitb2dd5cb61655b6ca82e8fd1fb117b42301d28c2b (patch)
tree98e25e54bcefd00d0169cbf18cf930bce17228d3
parent64994facce890e53a50bc75047e502e434c9c749 (diff)
downloadnextcloud-server-b2dd5cb61655b6ca82e8fd1fb117b42301d28c2b.tar.gz
nextcloud-server-b2dd5cb61655b6ca82e8fd1fb117b42301d28c2b.zip
save excluded groups in json format - fixes #10983
-rw-r--r--lib/private/util.php7
-rw-r--r--settings/admin.php2
-rw-r--r--settings/js/admin.js6
-rw-r--r--tests/lib/util.php2
4 files changed, 9 insertions, 8 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index 9abaef71a68..746a2e09523 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -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);
diff --git a/settings/admin.php b/settings/admin.php
index 31c9b8c1376..ec49b3e823f 100644
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -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();
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 7117c7b46cf..9f7133c6571 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -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);
});
});
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 49579b3b6bd..eaa3d0795e3 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -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();