From 0e6321957df6635d43ad07d7add23b1cea581fc0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 23 Apr 2021 20:20:56 +0200 Subject: [PATCH] allow excluding groups from creating link shares Signed-off-by: Robin Appelman --- apps/settings/js/admin.js | 2 +- apps/settings/lib/Settings/Admin/Sharing.php | 4 + .../templates/settings/admin/sharing.php | 10 +- lib/private/Server.php | 3 +- lib/private/Share20/Manager.php | 120 +++++++++--------- 5 files changed, 76 insertions(+), 63 deletions(-) diff --git a/apps/settings/js/admin.js b/apps/settings/js/admin.js index 271d13b43d0..f749c9e132c 100644 --- a/apps/settings/js/admin.js +++ b/apps/settings/js/admin.js @@ -1,5 +1,5 @@ window.addEventListener('DOMContentLoaded', function(){ - $('#excludedGroups').each(function (index, element) { + $('#excludedGroups,#linksExcludedGroups').each(function (index, element) { OC.Settings.setupGroupsSelect($(element)); $(element).change(function(ev) { var groups = ev.val || []; diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index 7eb9649a1aa..8d759b4ae85 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -64,11 +64,15 @@ class Sharing implements ISettings { $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); $excludeGroupsList = !is_null(json_decode($excludedGroups)) ? implode('|', json_decode($excludedGroups, true)) : ''; + $linksExcludedGroups = $this->config->getAppValue('core', 'shareapi_allow_links_exclude_groups', ''); + $linksExcludeGroupsList = !is_null(json_decode($linksExcludedGroups)) + ? implode('|', json_decode($linksExcludedGroups, true)) : ''; $parameters = [ // Built-In Sharing 'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'), 'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'), + 'allowLinksExcludeGroups' => $linksExcludeGroupsList, 'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'), 'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'), 'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'), diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 4bb2ddca7d9..9b562cface6 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -138,6 +138,14 @@

+

+ t('Exclude groups from creating link shares:'));?> +

+

+ +

">
- t('These groups will still be able to receive shares, but not to initiate them.')); ?> + t('These groups will still be able to receive shares, but not to initiate them.')); ?>