summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-22 21:28:13 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-22 21:28:13 +0100
commitd5be21fe8159f7dc567ae9c1264b1f9087f16e8e (patch)
treed132418dc6e54af935d129daa94e311ca5b9abba /lib
parente516612a257e4b542768146d9705b2c6f6999473 (diff)
parentcf3e740ae8ac74a4f37b6701e4a9b2288be34404 (diff)
downloadnextcloud-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 'lib')
-rw-r--r--lib/private/Share20/Manager.php12
-rw-r--r--lib/public/share/imanager.php7
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 95662dc0b60..4737de002cb 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -361,6 +361,11 @@ class Manager implements IManager {
* @throws \Exception
*/
protected function groupCreateChecks(\OCP\Share\IShare $share) {
+ // Verify group shares are allowed
+ if (!$this->allowGroupSharing()) {
+ throw new \Exception('Group sharing is now allowed');
+ }
+
// Verify if the user can share with this group
if ($this->shareWithGroupMembersOnly()) {
$sharedBy = $this->userManager->get($share->getSharedBy());
@@ -1108,6 +1113,13 @@ class Manager implements IManager {
return $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
}
+ /**
+ * Check if users can share with groups
+ * @return bool
+ */
+ public function allowGroupSharing() {
+ return $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
+ }
/**
* Copied from \OC_Util::isSharingDisabledForUser
diff --git a/lib/public/share/imanager.php b/lib/public/share/imanager.php
index 86a31e1f06d..64e5b554de9 100644
--- a/lib/public/share/imanager.php
+++ b/lib/public/share/imanager.php
@@ -222,6 +222,13 @@ interface IManager {
public function shareWithGroupMembersOnly();
/**
+ * Check if users can share with groups
+ * @return bool
+ * @since 9.0.1
+ */
+ public function allowGroupSharing();
+
+ /**
* Check if sharing is disabled for the given user
*
* @param string $userId