From b4ec7ca55983374a2365bad92c41eeb63514088d Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 15 Oct 2024 17:06:05 +0200 Subject: [PATCH] chore: Unify user related events to always provide a `getUid` method Signed-off-by: Ferdinand Thiessen --- core/Events/BeforePasswordResetEvent.php | 7 +++++++ core/Events/PasswordResetEvent.php | 7 +++++++ lib/public/AppFramework/Bootstrap/IRegistrationContext.php | 2 +- lib/public/User/Events/PasswordUpdatedEvent.php | 7 +++++++ lib/public/User/Events/UserDeletedEvent.php | 7 +++++++ lib/public/User/Events/UserLoggedInEvent.php | 7 +++++++ 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/core/Events/BeforePasswordResetEvent.php b/core/Events/BeforePasswordResetEvent.php index bd437479150c3..428ebfeefadc4 100644 --- a/core/Events/BeforePasswordResetEvent.php +++ b/core/Events/BeforePasswordResetEvent.php @@ -34,6 +34,13 @@ public function getUser(): IUser { return $this->user; } + /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } + /** * @since 25.0.0 */ diff --git a/core/Events/PasswordResetEvent.php b/core/Events/PasswordResetEvent.php index a159c71026332..868899513212f 100644 --- a/core/Events/PasswordResetEvent.php +++ b/core/Events/PasswordResetEvent.php @@ -34,6 +34,13 @@ public function getUser(): IUser { return $this->user; } + /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } + /** * @since 25.0.0 */ diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 57e76f268d986..b9e5413e5c260 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -69,7 +69,7 @@ public function registerDashboardWidget(string $widgetClass): void; * @param string $name * @param callable $factory * @psalm-param callable(\Psr\Container\ContainerInterface): mixed $factory - * @param bool $shared + * @param bool $shared If set to true the factory result will be cached otherwise every query will call the factory again * * @return void * @see IContainer::registerService() diff --git a/lib/public/User/Events/PasswordUpdatedEvent.php b/lib/public/User/Events/PasswordUpdatedEvent.php index 948b69e54b742..d3fd8f078fed2 100644 --- a/lib/public/User/Events/PasswordUpdatedEvent.php +++ b/lib/public/User/Events/PasswordUpdatedEvent.php @@ -49,6 +49,13 @@ public function getUser(): IUser { return $this->user; } + /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } + /** * @return string * @since 18.0.0 diff --git a/lib/public/User/Events/UserDeletedEvent.php b/lib/public/User/Events/UserDeletedEvent.php index c5b8e11c888fa..9b74ff960630c 100644 --- a/lib/public/User/Events/UserDeletedEvent.php +++ b/lib/public/User/Events/UserDeletedEvent.php @@ -34,4 +34,11 @@ public function __construct(IUser $user) { public function getUser(): IUser { return $this->user; } + + /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } } diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php index 61a7b1f79cdba..53f61073a5966 100644 --- a/lib/public/User/Events/UserLoggedInEvent.php +++ b/lib/public/User/Events/UserLoggedInEvent.php @@ -45,6 +45,13 @@ public function getUser(): IUser { return $this->user; } + /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } + /** * @since 21.0.0 */