diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-22 21:28:13 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-22 21:28:13 +0100 |
commit | d5be21fe8159f7dc567ae9c1264b1f9087f16e8e (patch) | |
tree | d132418dc6e54af935d129daa94e311ca5b9abba /apps/files_sharing/api | |
parent | e516612a257e4b542768146d9705b2c6f6999473 (diff) | |
parent | cf3e740ae8ac74a4f37b6701e4a9b2288be34404 (diff) | |
download | nextcloud-server-d5be21fe8159f7dc567ae9c1264b1f9087f16e8e.tar.gz nextcloud-server-d5be21fe8159f7dc567ae9c1264b1f9087f16e8e.zip |
Merge pull request #23398 from owncloud/block_group_sharing
Allow blocking of group sharing
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r-- | apps/files_sharing/api/share20ocs.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/api/sharees.php | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index efdd9ecb30e..61d5044cf84 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -275,6 +275,10 @@ class Share20OCS { $share->setSharedWith($shareWith); $share->setPermissions($permissions); } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + if (!$this->shareManager->allowGroupSharing()) { + return new \OC_OCS_Result(null, 404, 'group sharing is disabled by the administrator'); + } + // Valid group is required to share if ($shareWith === null || !$this->groupManager->groupExists($shareWith)) { return new \OC_OCS_Result(null, 404, 'please specify a valid group'); diff --git a/apps/files_sharing/api/sharees.php b/apps/files_sharing/api/sharees.php index 718be4dece9..4e005c5e26c 100644 --- a/apps/files_sharing/api/sharees.php +++ b/apps/files_sharing/api/sharees.php @@ -62,6 +62,9 @@ class Sharees { /** @var ILogger */ protected $logger; + /** @var \OCP\Share\IManager */ + protected $shareManager; + /** @var bool */ protected $shareWithGroupOnly = false; @@ -97,6 +100,7 @@ class Sharees { * @param IURLGenerator $urlGenerator * @param IRequest $request * @param ILogger $logger + * @param \OCP\Share\IManager $shareManager */ public function __construct(IGroupManager $groupManager, IUserManager $userManager, @@ -105,7 +109,8 @@ class Sharees { IUserSession $userSession, IURLGenerator $urlGenerator, IRequest $request, - ILogger $logger) { + ILogger $logger, + \OCP\Share\IManager $shareManager) { $this->groupManager = $groupManager; $this->userManager = $userManager; $this->contactsManager = $contactsManager; @@ -114,6 +119,7 @@ class Sharees { $this->urlGenerator = $urlGenerator; $this->request = $request; $this->logger = $logger; + $this->shareManager = $shareManager; } /** @@ -411,9 +417,14 @@ class Sharees { $shareTypes = [ Share::SHARE_TYPE_USER, - Share::SHARE_TYPE_GROUP, - Share::SHARE_TYPE_REMOTE, ]; + + if ($this->shareManager->allowGroupSharing()) { + $shareTypes[] = Share::SHARE_TYPE_GROUP; + } + + $shareTypes[] = Share::SHARE_TYPE_REMOTE; + if (isset($_GET['shareType']) && is_array($_GET['shareType'])) { $shareTypes = array_intersect($shareTypes, $_GET['shareType']); sort($shareTypes); |