Add getById

This commit is contained in:
brantje 2016-09-28 20:29:50 +02:00
parent d2b8902838
commit 30213a8fd2
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F

View file

@ -29,12 +29,29 @@ class VaultService {
return $this->vaultMapper->findVaultsFromUser($userId);
}
public function getById($vault_id, $user_id) {
$vault = $this->vaultMapper->find($vault_id, $user_id);
$vault = $vault[0];
$return = array(
'vault_id' => $vault->getId(),
'guid' => $vault->getGuid(),
'name' => $vault->getName(),
'created' => $vault->getCreated(),
'private_sharing_key' => $vault->getPrivateSharingKey(),
'public_sharing_key' => $vault->getPublicSharingKey(),
'sharing_keys_generated' => $vault->getSharingKeysGenerated(),
'settings' => $vault->getSettings(),
'last_access' => $vault->getlastAccess()
);
return $return;
}
public function createVault($vault_name, $userId) {
return $this->vaultMapper->create($vault_name, $userId);
}
public function setLastAccess($vault_id){
return $this->vaultMapper->setLastAccess($vault_id);
public function setLastAccess($vault_id, $user_id){
return $this->vaultMapper->setLastAccess($vault_id, $user_id);
}
public function updateSharingKeys($vault_id, $privateKey, $publicKey){