Skip to content

Commit

Permalink
chore: Unify user related events to always provide a getUid method
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Oct 15, 2024
1 parent 52d581f commit 0be66d1
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 6 deletions.
10 changes: 5 additions & 5 deletions apps/encryption/lib/Listeners/UserEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public function handle(Event $event): void {
$this->onUserDeleted($event->getUid());
} elseif ($event instanceof UserLoggedInEvent) {
$this->onUserLogin($event->getUser(), $event->getPassword());
} elseif($event instanceof UserLoggedOutEvent) {
} elseif ($event instanceof UserLoggedOutEvent) {
$this->onUserLogout();
} elseif($event instanceof BeforePasswordUpdatedEvent) {
} elseif ($event instanceof BeforePasswordUpdatedEvent) {
$this->onBeforePasswordUpdated($event->getUser(), $event->getPassword(), $event->getRecoveryPassword());
} elseif($event instanceof PasswordUpdatedEvent) {
} elseif ($event instanceof PasswordUpdatedEvent) {
$this->onPasswordUpdated($event->getUid(), $event->getPassword(), $event->getRecoveryPassword());
} elseif($event instanceof BeforePasswordResetEvent) {
} elseif ($event instanceof BeforePasswordResetEvent) {
$this->onBeforePasswordReset($event->getUid());
} elseif($event instanceof PasswordResetEvent) {
} elseif ($event instanceof PasswordResetEvent) {
$this->onPasswordReset($event->getUid(), $event->getPassword());
}
}
Expand Down
7 changes: 7 additions & 0 deletions core/Events/BeforePasswordResetEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 7 additions & 0 deletions core/Events/PasswordResetEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/public/AppFramework/Bootstrap/IRegistrationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions lib/public/User/Events/PasswordUpdatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions lib/public/User/Events/UserDeletedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
7 changes: 7 additions & 0 deletions lib/public/User/Events/UserLoggedInEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 0be66d1

Please sign in to comment.