diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-07-06 08:58:11 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-07-11 13:52:27 +0200 |
commit | 6f54f72bb40113662a9b906bebcf37393b45e9fa (patch) | |
tree | 430110ae54f18aaf6243c29eaf5e7d85ef4d14fd /apps/files_sharing/lib/Controller/ShareAPIController.php | |
parent | 5c6ed30369f5c4edcf46e5e882c6096a7e3cd01e (diff) | |
download | nextcloud-server-6f54f72bb40113662a9b906bebcf37393b45e9fa.tar.gz nextcloud-server-6f54f72bb40113662a9b906bebcf37393b45e9fa.zip |
feat(sharing): add sharing overview view
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/lib/Controller/ShareAPIController.php')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index e2fb950dceb..e80412f18b4 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -182,6 +182,11 @@ class ShareAPIController extends OCSController { $sharedBy = $this->userManager->get($share->getSharedBy()); $shareOwner = $this->userManager->get($share->getShareOwner()); + $isOwnShare = false; + if ($shareOwner !== null) { + $isOwnShare = $shareOwner->getUID() === $this->currentUser; + } + $result = [ 'id' => $share->getId(), 'share_type' => $share->getShareType(), @@ -225,6 +230,11 @@ class ShareAPIController extends OCSController { $result['item_type'] = 'file'; } + // Get the original node permission if the share owner is the current user + if ($isOwnShare) { + $result['permissions'] = $node->getPermissions(); + } + $result['mimetype'] = $node->getMimetype(); $result['has_preview'] = $this->previewManager->isAvailable($node); $result['storage_id'] = $node->getStorage()->getId(); @@ -233,6 +243,8 @@ class ShareAPIController extends OCSController { $result['file_source'] = $node->getId(); $result['file_parent'] = $node->getParent()->getId(); $result['file_target'] = $share->getTarget(); + $result['size'] = $node->getSize(); + $result['mtime'] = $node->getMTime(); $expiration = $share->getExpirationDate(); if ($expiration !== null) { @@ -1423,7 +1435,7 @@ class ShareAPIController extends OCSController { try { $formattedShare = $this->formatShare($share, $node); $formattedShare['status'] = $share->getStatus(); - $formattedShare['path'] = $share->getNode()->getName(); + $formattedShare['path'] = '/' . $share->getNode()->getName(); $formattedShare['permissions'] = 0; return $formattedShare; } catch (NotFoundException $e) { |