diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-13 15:22:18 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-22 10:43:44 +0200 |
commit | 12338e0ef07c409156fa9cd1008bb981bda20461 (patch) | |
tree | fe859814a2321ab98f498a623db39dab892b8153 /settings/js | |
parent | 14a953fbe01a3d26e1330ea224ab71928a2f93c1 (diff) | |
download | nextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.tar.gz nextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.zip |
allow admin to disable sharing for specific groups of users
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/admin.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js index cd11e68442a..249131464a8 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -1,4 +1,49 @@ +var SharingGroupList = { + applyMultipleSelect: function(element) { + var checked = []; + if ($(element).hasClass('groupsselect')) { + if (element.data('userGroups')) { + checked = element.data('userGroups'); + } + var checkHandeler = function(group) { + $.post(OC.filePath('settings', 'ajax', 'excludegroups.php'), + {changedGroup: group, selectedGroups: JSON.stringify(checked)}, + function() {}); + }; + + + var addGroup = function(select, group) { + $(this).each(function(index, element) { + if ($(element).find('option[value="' + group + '"]').length === 0 && + select.data('msid') !== $(element).data('msid')) { + $(element).append('<option value="' + escapeHTML(group) + '">' + + escapeHTML(group) + '</option>'); + } + }); + }; + + var label = null; + element.multiSelect({ + createCallback: addGroup, + createText: label, + selectedFirst: true, + checked: checked, + oncheck: checkHandeler, + onuncheck: checkHandeler, + minWidth: 100 + }); + + } + } +}; + $(document).ready(function(){ + + $('select#excludedGroups[multiple]').each(function (index, element) { + SharingGroupList.applyMultipleSelect($(element)); + }); + + $('#loglevel').change(function(){ $.post(OC.filePath('settings','ajax','setloglevel.php'), { level: $(this).val() },function(){ OC.Log.reload(); @@ -84,4 +129,8 @@ $(document).ready(function(){ OC.msg.finishedAction('#sendtestmail_msg', data); }); }); + + $('#shareapiExcludeGroups').change(function() { + $("#selectExcludedGroups").toggleClass('hidden', !this.checked); + }); }); |