summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/api
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-18 16:39:03 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-03-22 17:13:34 +0100
commite69a09756b17009ebe76862cf92f6494487ae8cc (patch)
tree97f6ac37ee51503e2aa77bdd067194493fb46a5c /apps/files_sharing/api
parent52826d0e24b354a38220a904fd21bb1860c70870 (diff)
downloadnextcloud-server-e69a09756b17009ebe76862cf92f6494487ae8cc.tar.gz
nextcloud-server-e69a09756b17009ebe76862cf92f6494487ae8cc.zip
Respect disabled group sharing in sharee endpoint
* Fix tests
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r--apps/files_sharing/api/sharees.php17
1 files changed, 14 insertions, 3 deletions
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);