Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2017-01-11 23:16:19 +0300
committerbrantje <brantje@gmail.com>2017-01-11 23:25:18 +0300
commit331eda72ff966dd6792b1555d130a8997f567ff2 (patch)
tree4d1a404dad86d85662e3b860f323b182400960a0 /controller
parentbec1ac46ebaf9ede69b03e9014f389e21e2fe42a (diff)
Clean up when a credential is deleted
Diffstat (limited to 'controller')
-rw-r--r--controller/credentialcontroller.php4
-rw-r--r--controller/sharecontroller.php15
2 files changed, 5 insertions, 14 deletions
diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php
index cd629986..e956a131 100644
--- a/controller/credentialcontroller.php
+++ b/controller/credentialcontroller.php
@@ -266,6 +266,10 @@ class CredentialController extends ApiController {
'item_destroyed_self', array($credential->getLabel()),
'', array(),
'', $this->userId, Activity::TYPE_ITEM_ACTION);
+ $this->sharingService->unshareCredential($credential->getGuid());
+ foreach($this->credentialRevisionService->getRevisions($credential->getId()) as $revision){
+ $this->credentialRevisionService->deleteRevision($revision->getId(), $this->userId);
+ }
} else {
$result = false;
}
diff --git a/controller/sharecontroller.php b/controller/sharecontroller.php
index 89c9fbe6..7c921b53 100644
--- a/controller/sharecontroller.php
+++ b/controller/sharecontroller.php
@@ -213,20 +213,7 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function unshareCredential($item_guid) {
- $acl_list = $this->shareService->getCredentialAclList($item_guid);
- $request_list = $this->shareService->getShareRequestsByGuid($item_guid);
- foreach ($acl_list as $ACL) {
- $this->shareService->deleteShareACL($ACL);
- }
- foreach ($request_list as $request) {
- $this->shareService->deleteShareRequest($request);
- $manager = \OC::$server->getNotificationManager();
- $notification = $manager->createNotification();
- $notification->setApp('passman')
- ->setObject('passman_share_request', $request->getId())
- ->setUser($request->getTargetUserId());
- $manager->markProcessed($notification);
- }
+ $this->shareService->unshareCredential($item_guid);
return new JSONResponse(array('result' => true));
}