* @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);
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);
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
}
- $output = $this->formatShare($share);
+ $output = $this->formatShare($share, $recipientNode);
return new DataResponse($output);
}
$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();
});
// 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;
}
throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
}
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
return $date;
}
// 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();
/**
* Lock a Node
+ *
* @param \OCP\Files\Node $node
*/
private function lock(\OCP\Files\Node $node) {