From e4b5645883d89ee3aca4105c1bde6ae4939f927c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 29 Jan 2021 15:59:41 +0100 Subject: [PATCH] Also make other shares listen to the "Allow sharing with groups" Signed-off-by: Joas Schilling --- .../lib/Controller/ShareesAPIController.php | 4 +++- .../Collaboration/Collaborators/GroupPlugin.php | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 8018f99e49a..571ea707e69 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -192,7 +192,9 @@ class ShareesAPIController extends OCSController { $shareTypes[] = IShare::TYPE_DECK; } } else { - $shareTypes[] = IShare::TYPE_GROUP; + if ($this->shareManager->allowGroupSharing()) { + $shareTypes[] = IShare::TYPE_GROUP; + } $shareTypes[] = IShare::TYPE_EMAIL; } diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index 18a6631ed80..5161f67beb9 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -38,8 +38,14 @@ use OCP\IUserSession; use OCP\Share\IShare; class GroupPlugin implements ISearchPlugin { + /** @var bool */ protected $shareeEnumeration; + /** @var bool */ protected $shareWithGroupOnly; + /** @var bool */ + protected $shareeEnumerationInGroupOnly; + /** @var bool */ + protected $groupSharingDisabled; /** @var IGroupManager */ private $groupManager; @@ -56,9 +62,14 @@ class GroupPlugin implements ISearchPlugin { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; $this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; + $this->groupSharingDisabled = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'no'; } public function search($search, $limit, $offset, ISearchResult $searchResult) { + if ($this->groupSharingDisabled) { + return false; + } + $hasMoreResults = false; $result = ['wide' => [], 'exact' => []];