diff options
author | brantje <brantje@gmail.com> | 2017-01-11 23:16:19 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2017-01-11 23:25:18 +0300 |
commit | 331eda72ff966dd6792b1555d130a8997f567ff2 (patch) | |
tree | 4d1a404dad86d85662e3b860f323b182400960a0 /lib | |
parent | bec1ac46ebaf9ede69b03e9014f389e21e2fe42a (diff) |
Clean up when a credential is deleted
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/ShareService.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index 7faed869..8dec01db 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -315,4 +315,27 @@ class ShareService { public function updatePendingShareRequestsForCredential($item_guid, $user_id, $permissions) { return $this->shareRequest->updatePendingRequestPermissions($item_guid, $user_id, $permissions); } + + /** + * Clean up on credential destroyed. + * This will delete all ACL's and share requests. + * @param string $item_guid + */ + + public function unshareCredential($item_guid) { + $acl_list = $this->getCredentialAclList($item_guid); + $request_list = $this->getShareRequestsByGuid($item_guid); + foreach ($acl_list as $ACL) { + $this->deleteShareACL($ACL); + } + foreach ($request_list as $request) { + $this->deleteShareRequest($request); + $manager = \OC::$server->getNotificationManager(); + $notification = $manager->createNotification(); + $notification->setApp('passman') + ->setObject('passman_share_request', $request->getId()) + ->setUser($request->getTargetUserId()); + $manager->markProcessed($notification); + } + } }
\ No newline at end of file |