diff options
author | dartcafe <github@dartcafe.de> | 2021-04-28 00:13:10 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-04-28 00:13:10 +0300 |
commit | 0cfffdb46edcf0d12bbeb2b091196bc9e1fde923 (patch) | |
tree | d8200c954ffa129840e1945681c14479f3da7bbd /lib | |
parent | b3f3661dc21ddd0c5c05d92b98bb82bf68d59f9a (diff) |
delete shares by userId
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Cron/UserDeletedJob.php | 7 | ||||
-rw-r--r-- | lib/Db/ShareMapper.php | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Cron/UserDeletedJob.php b/lib/Cron/UserDeletedJob.php index 109ce027..0b66764a 100644 --- a/lib/Cron/UserDeletedJob.php +++ b/lib/Cron/UserDeletedJob.php @@ -33,6 +33,7 @@ use OCA\Polls\Db\LogMapper; use OCA\Polls\Db\OptionMapper; use OCA\Polls\Db\PollMapper; use OCA\Polls\Db\PreferencesMapper; +use OCA\Polls\Db\ShareMapper; use OCA\Polls\Db\SubscriptionMapper; use OCA\Polls\Db\VoteMapper; @@ -56,6 +57,9 @@ class UserDeletedJob extends QueuedJob { /** @var SubscriptionMapper **/ private $subscriptionMapper; + /** @var ShareMapper **/ + private $shareMapper; + /** @var VoteMapper **/ private $voteMapper; @@ -67,6 +71,7 @@ class UserDeletedJob extends QueuedJob { OptionMapper $optionMapper, PollMapper $pollMapper, PreferencesMapper $preferencesMapper, + ShareMapper $shareMapper, SubscriptionMapper $subscriptionMapper, VoteMapper $voteMapper, ITimeFactory $time, @@ -78,6 +83,7 @@ class UserDeletedJob extends QueuedJob { $this->optionMapper = $optionMapper; $this->pollMapper = $pollMapper; $this->preferencesMapper = $preferencesMapper; + $this->shareMapper = $shareMapper; $this->subscriptionMapper = $subscriptionMapper; $this->voteMapper = $voteMapper; $this->logger = $logger; @@ -98,6 +104,7 @@ class UserDeletedJob extends QueuedJob { $this->pollMapper->deleteByUserId($owner); $this->logMapper->deleteByUserId($owner); + $this->shareMapper->deleteByUserId($owner); $this->preferencesMapper->deleteByUserId($owner); $this->subscriptionMapper->deleteByUserId($owner); $this->commentMapper->renameUserId($owner, $replacementName); diff --git a/lib/Db/ShareMapper.php b/lib/Db/ShareMapper.php index f7ee8853..32074ca1 100644 --- a/lib/Db/ShareMapper.php +++ b/lib/Db/ShareMapper.php @@ -119,6 +119,17 @@ class ShareMapper extends QBMapper { /** * @return void */ + public function deleteByUserId(string $userId): void { + $query = $this->db->getQueryBuilder(); + $query->delete($this->getTableName()) + ->where('user_id = :userId') + ->setParameter('userId', $userId); + $query->execute(); + } + + /** + * @return void + */ public function remove($shareId): void { $qb = $this->db->getQueryBuilder(); |