1
0

UserLoggedInEvent.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\User\Events;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\IUser;
  10. /**
  11. * @since 18.0.0
  12. */
  13. class UserLoggedInEvent extends Event {
  14. /** @var IUser */
  15. private $user;
  16. /** @var string|null */
  17. private $password;
  18. /** @var bool */
  19. private $isTokenLogin;
  20. /** @var string */
  21. private $loginName;
  22. /**
  23. * @since 18.0.0
  24. */
  25. public function __construct(IUser $user, string $loginName, ?string $password, bool $isTokenLogin) {
  26. parent::__construct();
  27. $this->user = $user;
  28. $this->password = $password;
  29. $this->isTokenLogin = $isTokenLogin;
  30. $this->loginName = $loginName;
  31. }
  32. /**
  33. * @since 18.0.0
  34. */
  35. public function getUser(): IUser {
  36. return $this->user;
  37. }
  38. /**
  39. * @since 31.0.0
  40. */
  41. public function getUid(): string {
  42. return $this->user->getUID();
  43. }
  44. /**
  45. * @since 21.0.0
  46. */
  47. public function getLoginName(): string {
  48. return $this->loginName;
  49. }
  50. /**
  51. * @since 18.0.0
  52. */
  53. public function getPassword(): ?string {
  54. return $this->password;
  55. }
  56. /**
  57. * @since 18.0.0
  58. */
  59. public function isTokenLogin(): bool {
  60. return $this->isTokenLogin;
  61. }
  62. }