summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-07-04 10:39:13 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-11 10:11:48 +0200
commit3942d731d21e6369c395358699a9561519992069 (patch)
tree0f310ce8856af82c1f279a1e1e6f323cba9f1483 /apps/files_sharing/lib
parent5b06a7d773d303a9b01c98eb714fd1829129646f (diff)
downloadnextcloud-server-3942d731d21e6369c395358699a9561519992069.tar.gz
nextcloud-server-3942d731d21e6369c395358699a9561519992069.zip
update unit tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php8
-rw-r--r--apps/files_sharing/lib/External/Manager.php8
-rw-r--r--apps/files_sharing/lib/ShareBackend/File.php4
3 files changed, 15 insertions, 5 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index c60e873b826..ee95661d4c6 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -223,7 +223,13 @@ class ShareesAPIController extends OCSController {
}
protected function isRemoteGroupSharingAllowed(string $itemType): bool {
- return true;
+ try {
+ // FIXME: static foo makes unit testing unnecessarily difficult
+ $backend = \OC\Share\Share::getBackend($itemType);
+ return $backend->isShareTypeAllowed(Share::SHARE_TYPE_REMOTE_GROUP);
+ } catch (\Exception $e) {
+ return false;
+ }
}
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index 9f8acbce4cb..a3b037e4982 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -276,15 +276,16 @@ class Manager {
$mountPoint = Files::buildNotExistingFileName($shareFolder, $share['name']);
$mountPoint = Filesystem::normalizePath($mountPoint);
$hash = md5($mountPoint);
+ $userShareAccepted = false;
- if($share['share_type'] === Share::SHARE_TYPE_USER) {
+ if((int)$share['share_type'] === Share::SHARE_TYPE_USER) {
$acceptShare = $this->connection->prepare('
UPDATE `*PREFIX*share_external`
SET `accepted` = ?,
`mountpoint` = ?,
`mountpoint_hash` = ?
WHERE `id` = ? AND `user` = ?');
- $updated = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
+ $userShareAccepted = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
} else {
$result = $this->writeShareToDb(
$share['remote'],
@@ -297,9 +298,8 @@ class Manager {
$share['remote_id'],
$id,
$share['share_type']);
- // TODO group share, add additional row for the user who accepted it
}
- if ($updated === true) {
+ if ($userShareAccepted === true) {
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
\OC_Hook::emit(Share::class, 'federated_share_added', ['server' => $share['remote']]);
$result = true;
diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php
index bb28c1a33ac..bd32741e67e 100644
--- a/apps/files_sharing/lib/ShareBackend/File.php
+++ b/apps/files_sharing/lib/ShareBackend/File.php
@@ -195,6 +195,10 @@ class File implements \OCP\Share_Backend_File_Dependent {
return $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
}
+ if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
+ return $this->federatedShareProvider->isOutgoingServer2serverGroupShareEnabled();
+ }
+
return true;
}