mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-10 21:46:25 +08:00
delete credential notifications on credential delete
This commit is contained in:
parent
594583bd00
commit
a31dee3343
2 changed files with 11 additions and 0 deletions
|
@ -48,6 +48,7 @@ class CredentialService {
|
|||
private CredentialRevisionService $credentialRevisionService,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private VaultService $vaultService,
|
||||
private NotificationService $notificationService,
|
||||
IConfig $config,
|
||||
) {
|
||||
$this->server_key = $config->getSystemValue('passwordsalt', '');
|
||||
|
@ -120,6 +121,7 @@ class CredentialService {
|
|||
$this->credentialRevisionService->deleteRevision($id, $userId);
|
||||
}
|
||||
}
|
||||
$this->notificationService->deleteNotificationsOfCredential($credential);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,4 +111,13 @@ class NotificationService {
|
|||
->andWhere($qb->expr()->eq('subject', $qb->createNamedParameter('credential_expired', IQueryBuilder::PARAM_STR)));
|
||||
return $qb->execute()->rowCount() !== 0;
|
||||
}
|
||||
|
||||
function deleteNotificationsOfCredential($credential) {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->delete()
|
||||
->from('notifications')
|
||||
->where($qb->expr()->eq('object_id', $qb->createNamedParameter($credential->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($qb->expr()->eq('object_type', 'credential'));
|
||||
return $qb->execute();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue