From 7252aa7f4aaef885a295efe2d0aa7762e22d3108 Mon Sep 17 00:00:00 2001 From: Marcos Zuriaga Date: Sun, 2 Oct 2016 19:04:19 +0200 Subject: [PATCH] Api endpoint to get items shared with a vault --- appinfo/routes.php | 1 + controller/sharecontroller.php | 4 ++-- lib/Service/ShareService.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index a9236c83..27acd46c 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -53,6 +53,7 @@ return [ ['name' => 'share#savePendingRequest', 'url' => '/api/v2/sharing/save', 'verb' => 'POST'], ['name' => 'share#getPendingRequests', 'url' => '/api/v2/sharing/pending', 'verb' => 'GET'], ['name' => 'share#deleteShareRequest', 'url' => '/api/v2/sharing/decline/{share_request_id}', 'verb' => 'DELETE'], + ['name' => 'share#getVaultItems', 'url' => '/api/v2/sharing/get/{vault_guid}', 'verb' => 'GET'], //Internal API diff --git a/controller/sharecontroller.php b/controller/sharecontroller.php index 469ff2e8..8f2c72fd 100644 --- a/controller/sharecontroller.php +++ b/controller/sharecontroller.php @@ -210,8 +210,8 @@ class ShareController extends ApiController { * Obtains the list of credentials shared with this vault * @NoAdminRequired */ - public function getSharedItems($vault_guid){ - + public function getVaultItems($vault_guid){ + $this->shareService->getSharedItems($this->userId, $vault_guid); } public function deleteShareRequest($share_request_id){ diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index 6d986f00..441bfc09 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -93,8 +93,8 @@ class ShareService { return $this->shareRequest->getUserPendingRequests($user_id); } - public function getSharedItems($user_id, $vault_id){ - $entries = $this->sharingACL->getVaultEntries($user_id, $vault_id); + public function getSharedItems($user_id, $vault_guid){ + $entries = $this->sharingACL->getVaultEntries($user_id, $vault_guid); $return = []; foreach ($entries as $entry){ $tmp = $entry->jsonSerialize();