diff options
author | brantje <brantje@gmail.com> | 2017-01-12 01:55:28 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2017-01-12 02:17:23 +0300 |
commit | a8ae7e0bdaf9c88a05df4f7de26292baa7c03736 (patch) | |
tree | 8de1e153e1ae70e74f971a18768bdccd090d3b3f /lib | |
parent | abe26ea906badd13c896147f29b87f8575e9fed0 (diff) |
Implement delete vault
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Db/VaultMapper.php | 8 | ||||
-rw-r--r-- | lib/Service/VaultService.php | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/Db/VaultMapper.php b/lib/Db/VaultMapper.php index 071bbd98..6844458c 100644 --- a/lib/Db/VaultMapper.php +++ b/lib/Db/VaultMapper.php @@ -120,4 +120,12 @@ class VaultMapper extends Mapper { $vault->setSharingKeysGenerated($this->utils->getTime()); $this->update($vault); } + + /** + * Delete a vault + * @param Vault $vault + */ + public function deleteVault(Vault $vault){ + $this->delete($vault); + } }
\ No newline at end of file diff --git a/lib/Service/VaultService.php b/lib/Service/VaultService.php index 8e7a8d83..43e3a519 100644 --- a/lib/Service/VaultService.php +++ b/lib/Service/VaultService.php @@ -23,6 +23,7 @@ namespace OCA\Passman\Service; +use OCA\Passman\Db\Vault; use OCP\IConfig; use OCP\AppFramework\Db\DoesNotExistException; @@ -104,4 +105,16 @@ class VaultService { public function updateSharingKeys($vault_id, $privateKey, $publicKey){ return $this->vaultMapper->updateSharingKeys($vault_id, $privateKey, $publicKey); } + + /** + * Delete a vault from user + * @param string $vault_guid + * @param string $user_id + */ + public function deleteVault($vault_guid, $user_id){ + $vault = $this->getByGuid($vault_guid, $user_id); + if($vault instanceof Vault) { + $this->vaultMapper->deleteVault($vault); + } + } }
\ No newline at end of file |