From 08ac663fc223e35a37bbe3f089e6c9b816c5fb82 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 9 Jul 2020 21:56:14 +0200 Subject: Use new dispatcher for password policy event Signed-off-by: Morris Jobke --- appinfo/info.xml | 2 +- lib/Backend/UserBackend.php | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 0c4c844..6d72844 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -22,7 +22,7 @@ auth - + \OCA\UserSQL\Settings\Admin diff --git a/lib/Backend/UserBackend.php b/lib/Backend/UserBackend.php index fca2959..da472eb 100644 --- a/lib/Backend/UserBackend.php +++ b/lib/Backend/UserBackend.php @@ -34,9 +34,11 @@ use OCA\UserSQL\Crypto\IPasswordAlgorithm; use OCA\UserSQL\Model\User; use OCA\UserSQL\Properties; use OCA\UserSQL\Repository\UserRepository; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; +use OCP\Security\Events\ValidatePasswordPolicyEvent; use OCP\User\Backend\ABackend; use OCP\User\Backend\ICheckPasswordBackend; use OCP\User\Backend\ICountUsersBackend; @@ -46,8 +48,6 @@ use OCP\User\Backend\IPasswordConfirmationBackend; use OCP\User\Backend\IProvideAvatarBackend; use OCP\User\Backend\ISetDisplayNameBackend; use OCP\User\Backend\ISetPasswordBackend; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\GenericEvent; /** * The SQL user backend manager. @@ -93,7 +93,7 @@ final class UserBackend extends ABackend implements */ private $config; /** - * @var EventDispatcher The event dispatcher. + * @var IEventDispatcher The event dispatcher. */ private $eventDispatcher; /** @@ -111,12 +111,12 @@ final class UserBackend extends ABackend implements * @param UserRepository $userRepository The user repository. * @param IL10N $localization The localization service. * @param IConfig $config The config instance. - * @param EventDispatcher $eventDispatcher The event dispatcher. + * @param IEventDispatcher $eventDispatcher The event dispatcher. */ public function __construct( $AppName, Cache $cache, ILogger $logger, Properties $properties, UserRepository $userRepository, IL10N $localization, IConfig $config, - EventDispatcher $eventDispatcher + IEventDispatcher $eventDispatcher ) { $this->appName = $AppName; $this->cache = $cache; @@ -515,10 +515,8 @@ final class UserBackend extends ABackend implements return false; } - $event = new GenericEvent($password); - $this->eventDispatcher->dispatch( - 'OCP\PasswordPolicy::validate', $event - ); + $event = new ValidatePasswordPolicyEvent($password); + $this->eventDispatcher->dispatchTyped($event); $user = $this->userRepository->findByUid($uid); if (!($user instanceof User)) { -- cgit v1.2.3 From a17a52ea4aefadb6a6c243262b4edafe2aaea7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=81ojewski?= Date: Sun, 12 Jul 2020 16:11:29 +0200 Subject: Comments alignment --- lib/Backend/UserBackend.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Backend/UserBackend.php b/lib/Backend/UserBackend.php index da472eb..c78bc0d 100644 --- a/lib/Backend/UserBackend.php +++ b/lib/Backend/UserBackend.php @@ -104,13 +104,13 @@ final class UserBackend extends ABackend implements /** * The default constructor. * - * @param string $AppName The application name. - * @param Cache $cache The cache instance. - * @param ILogger $logger The logger instance. - * @param Properties $properties The properties array. - * @param UserRepository $userRepository The user repository. - * @param IL10N $localization The localization service. - * @param IConfig $config The config instance. + * @param string $AppName The application name. + * @param Cache $cache The cache instance. + * @param ILogger $logger The logger instance. + * @param Properties $properties The properties array. + * @param UserRepository $userRepository The user repository. + * @param IL10N $localization The localization service. + * @param IConfig $config The config instance. * @param IEventDispatcher $eventDispatcher The event dispatcher. */ public function __construct( -- cgit v1.2.3