summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/lib/AppInfo/Application.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/twofactor_backupcodes/lib/AppInfo/Application.php')
-rw-r--r--apps/twofactor_backupcodes/lib/AppInfo/Application.php21
1 files changed, 4 insertions, 17 deletions
diff --git a/apps/twofactor_backupcodes/lib/AppInfo/Application.php b/apps/twofactor_backupcodes/lib/AppInfo/Application.php
index 67c09019d04..8751ccb8f6f 100644
--- a/apps/twofactor_backupcodes/lib/AppInfo/Application.php
+++ b/apps/twofactor_backupcodes/lib/AppInfo/Application.php
@@ -28,20 +28,20 @@ declare(strict_types=1);
namespace OCA\TwoFactorBackupCodes\AppInfo;
-use OCA\TwoFactorBackupCodes\Db\BackupCodeMapper;
use OCA\TwoFactorBackupCodes\Event\CodesGenerated;
use OCA\TwoFactorBackupCodes\Listener\ActivityPublisher;
use OCA\TwoFactorBackupCodes\Listener\ClearNotifications;
use OCA\TwoFactorBackupCodes\Listener\ProviderDisabled;
use OCA\TwoFactorBackupCodes\Listener\ProviderEnabled;
use OCA\TwoFactorBackupCodes\Listener\RegistryUpdater;
+use OCA\TwoFactorBackupCodes\Listener\UserDeleted;
use OCA\TwoFactorBackupCodes\Notifications\Notifier;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Authentication\TwoFactorAuth\IRegistry;
-use OCP\Util;
+use OCP\User\Events\UserDeletedEvent;
class Application extends App implements IBootstrap {
public const APP_ID = 'twofactor_backupcodes';
@@ -51,29 +51,16 @@ class Application extends App implements IBootstrap {
}
public function register(IRegistrationContext $context): void {
- $this->registerHooksAndEvents($context);
-
$context->registerNotifierService(Notifier::class);
- }
-
- public function boot(IBootContext $context): void {
- Util::connectHook('OC_User', 'post_deleteUser', $this, 'deleteUser');
- }
- /**
- * Register the hooks and events
- */
- public function registerHooksAndEvents(IRegistrationContext $context) {
$context->registerEventListener(CodesGenerated::class, ActivityPublisher::class);
$context->registerEventListener(CodesGenerated::class, RegistryUpdater::class);
$context->registerEventListener(CodesGenerated::class, ClearNotifications::class);
$context->registerEventListener(IRegistry::EVENT_PROVIDER_ENABLED, ProviderEnabled::class);
$context->registerEventListener(IRegistry::EVENT_PROVIDER_DISABLED, ProviderDisabled::class);
+ $context->registerEventListener(UserDeletedEvent::class, UserDeleted::class);
}
- public function deleteUser($params) {
- /** @var BackupCodeMapper $mapper */
- $mapper = $this->getContainer()->query(BackupCodeMapper::class);
- $mapper->deleteCodesByUserId($params['uid']);
+ public function boot(IBootContext $context): void {
}
}