Api endpoint to get items shared with a vault

This commit is contained in:
Marcos Zuriaga 2016-10-02 19:04:19 +02:00
parent 01a0d8bf05
commit 7252aa7f4a
No known key found for this signature in database
GPG key ID: 7D15585354D072FF
3 changed files with 5 additions and 4 deletions

View file

@ -53,6 +53,7 @@ return [
['name' => 'share#savePendingRequest', 'url' => '/api/v2/sharing/save', 'verb' => 'POST'], ['name' => 'share#savePendingRequest', 'url' => '/api/v2/sharing/save', 'verb' => 'POST'],
['name' => 'share#getPendingRequests', 'url' => '/api/v2/sharing/pending', 'verb' => 'GET'], ['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#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 //Internal API

View file

@ -210,8 +210,8 @@ class ShareController extends ApiController {
* Obtains the list of credentials shared with this vault * Obtains the list of credentials shared with this vault
* @NoAdminRequired * @NoAdminRequired
*/ */
public function getSharedItems($vault_guid){ public function getVaultItems($vault_guid){
$this->shareService->getSharedItems($this->userId, $vault_guid);
} }
public function deleteShareRequest($share_request_id){ public function deleteShareRequest($share_request_id){

View file

@ -93,8 +93,8 @@ class ShareService {
return $this->shareRequest->getUserPendingRequests($user_id); return $this->shareRequest->getUserPendingRequests($user_id);
} }
public function getSharedItems($user_id, $vault_id){ public function getSharedItems($user_id, $vault_guid){
$entries = $this->sharingACL->getVaultEntries($user_id, $vault_id); $entries = $this->sharingACL->getVaultEntries($user_id, $vault_guid);
$return = []; $return = [];
foreach ($entries as $entry){ foreach ($entries as $entry){
$tmp = $entry->jsonSerialize(); $tmp = $entry->jsonSerialize();