aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-21 17:35:09 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-12 16:12:37 +0200
commit9754724c8b3afca625d9f6f4bbd3442c50c8ad33 (patch)
treec0323efd90331757007406c70afa3708ddded628
parent240538d9e6b12327a6affacbfc744ba51cb70be8 (diff)
downloadnextcloud-server-9754724c8b3afca625d9f6f4bbd3442c50c8ad33.tar.gz
nextcloud-server-9754724c8b3afca625d9f6f4bbd3442c50c8ad33.zip
fix getting recipient share in ocs api
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/files_sharing/lib/API/Share20OCS.php32
1 files changed, 18 insertions, 14 deletions
diff --git a/apps/files_sharing/lib/API/Share20OCS.php b/apps/files_sharing/lib/API/Share20OCS.php
index 4ec4a006be2..d5a6d8bc9db 100644
--- a/apps/files_sharing/lib/API/Share20OCS.php
+++ b/apps/files_sharing/lib/API/Share20OCS.php
@@ -85,15 +85,15 @@ class Share20OCS extends OCSController {
* @param IL10N $l10n
*/
public function __construct(
- $appName,
- IRequest $request,
- IManager $shareManager,
- IGroupManager $groupManager,
- IUserManager $userManager,
- IRootFolder $rootFolder,
- IURLGenerator $urlGenerator,
- IUser $currentUser,
- IL10N $l10n
+ $appName,
+ IRequest $request,
+ IManager $shareManager,
+ IGroupManager $groupManager,
+ IUserManager $userManager,
+ IRootFolder $rootFolder,
+ IURLGenerator $urlGenerator,
+ IUser $currentUser,
+ IL10N $l10n
) {
parent::__construct($appName, $request);
@@ -405,6 +405,8 @@ class Share20OCS extends OCSController {
try {
$share = $this->shareManager->createShare($share);
+ $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
+ $recipientNode = $userFolder->get($share->getTarget());
} catch (GenericShareException $e) {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code);
@@ -414,7 +416,7 @@ class Share20OCS extends OCSController {
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
}
- $output = $this->formatShare($share);
+ $output = $this->formatShare($share, $recipientNode);
return new DataResponse($output);
}
@@ -429,7 +431,7 @@ class Share20OCS extends OCSController {
$shares = array_merge($userShares, $groupShares);
- $shares = array_filter($shares, function(IShare $share) {
+ $shares = array_filter($shares, function (IShare $share) {
return $share->getShareOwner() !== $this->currentUser->getUID();
});
@@ -716,7 +718,8 @@ class Share20OCS extends OCSController {
// If the share is shared with you (or a group you are a member of)
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
- $share->getSharedWith() === $this->currentUser->getUID()) {
+ $share->getSharedWith() === $this->currentUser->getUID()
+ ) {
return true;
}
@@ -751,7 +754,7 @@ class Share20OCS extends OCSController {
throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
}
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
return $date;
}
@@ -769,7 +772,7 @@ class Share20OCS extends OCSController {
// First check if it is an internal share.
try {
- $share = $this->shareManager->getShareById('ocinternal:'.$id);
+ $share = $this->shareManager->getShareById('ocinternal:' . $id);
} catch (ShareNotFound $e) {
if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) {
throw new ShareNotFound();
@@ -783,6 +786,7 @@ class Share20OCS extends OCSController {
/**
* Lock a Node
+ *
* @param \OCP\Files\Node $node
*/
private function lock(\OCP\Files\Node $node) {