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 | |
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')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 14 | ||||
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index eff4a3ac5b7..9051d123f1e 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -231,7 +231,7 @@ class Application extends App implements IBootstrap { if ($shareManager->sharingDisabledForUser($userId) === false) { $sharingSublistArray[] = [ - 'id' => 'sharingout', + 'id' => 'sharingoutOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 16, @@ -240,7 +240,7 @@ class Application extends App implements IBootstrap { } $sharingSublistArray[] = [ - 'id' => 'sharingin', + 'id' => 'sharinginOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 15, @@ -251,7 +251,7 @@ class Application extends App implements IBootstrap { // Check if sharing by link is enabled if ($shareManager->shareApiAllowLinks()) { $sharingSublistArray[] = [ - 'id' => 'sharinglinks', + 'id' => 'sharinglinksOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 17, @@ -261,7 +261,7 @@ class Application extends App implements IBootstrap { } $sharingSublistArray[] = [ - 'id' => 'deletedshares', + 'id' => 'deletedsharesOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 19, @@ -269,7 +269,7 @@ class Application extends App implements IBootstrap { ]; $sharingSublistArray[] = [ - 'id' => 'pendingshares', + 'id' => 'pendingsharesOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 19, @@ -277,11 +277,11 @@ class Application extends App implements IBootstrap { ]; return [ - 'id' => 'shareoverview', + 'id' => 'shareoverviewOld', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 18, - 'name' => $l->t('Shares'), + 'name' => $l->t('Shares (old)'), 'classes' => 'collapsible', 'sublist' => $sharingSublistArray, ]; 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) { |