diff options
Diffstat (limited to 'lib/public/User')
-rw-r--r-- | lib/public/User/Backend/ICountUsersBackend.php | 1 | ||||
-rw-r--r-- | lib/public/User/Backend/IGetRealUIDBackend.php | 2 | ||||
-rw-r--r-- | lib/public/User/Backend/ILimitAwareCountUsersBackend.php | 23 | ||||
-rw-r--r-- | lib/public/User/Backend/IPasswordHashBackend.php | 30 | ||||
-rw-r--r-- | lib/public/User/Events/BeforeUserIdUnassignedEvent.php | 34 | ||||
-rw-r--r-- | lib/public/User/Events/OutOfOfficeChangedEvent.php | 4 | ||||
-rw-r--r-- | lib/public/User/Events/OutOfOfficeClearedEvent.php | 4 | ||||
-rw-r--r-- | lib/public/User/Events/OutOfOfficeEndedEvent.php | 4 | ||||
-rw-r--r-- | lib/public/User/Events/OutOfOfficeScheduledEvent.php | 4 | ||||
-rw-r--r-- | lib/public/User/Events/OutOfOfficeStartedEvent.php | 4 | ||||
-rw-r--r-- | lib/public/User/Events/PasswordUpdatedEvent.php | 7 | ||||
-rw-r--r-- | lib/public/User/Events/UserDeletedEvent.php | 7 | ||||
-rw-r--r-- | lib/public/User/Events/UserIdAssignedEvent.php | 34 | ||||
-rw-r--r-- | lib/public/User/Events/UserIdUnassignedEvent.php | 34 | ||||
-rw-r--r-- | lib/public/User/Events/UserLoggedInEvent.php | 7 | ||||
-rw-r--r-- | lib/public/User/IOutOfOfficeData.php | 16 |
16 files changed, 209 insertions, 6 deletions
diff --git a/lib/public/User/Backend/ICountUsersBackend.php b/lib/public/User/Backend/ICountUsersBackend.php index e337147dd14..194cf465cbe 100644 --- a/lib/public/User/Backend/ICountUsersBackend.php +++ b/lib/public/User/Backend/ICountUsersBackend.php @@ -10,6 +10,7 @@ namespace OCP\User\Backend; /** * @since 14.0.0 + * @deprecated 31.0.0 use and implement ILimitAwareCountUsersBackend instead. */ interface ICountUsersBackend { /** diff --git a/lib/public/User/Backend/IGetRealUIDBackend.php b/lib/public/User/Backend/IGetRealUIDBackend.php index 08ac09f2b5c..8041043f7d5 100644 --- a/lib/public/User/Backend/IGetRealUIDBackend.php +++ b/lib/public/User/Backend/IGetRealUIDBackend.php @@ -17,7 +17,7 @@ interface IGetRealUIDBackend { * For example the database backend accepts different cased UIDs in all the functions * but the internal UID that is to be used should be correctly cased. * - * This little function makes sure that the used UID will be correct hen using the user object + * This little function makes sure that the used UID will be correct when using the user object * * @since 17.0.0 * @param string $uid diff --git a/lib/public/User/Backend/ILimitAwareCountUsersBackend.php b/lib/public/User/Backend/ILimitAwareCountUsersBackend.php new file mode 100644 index 00000000000..a59c0bd8e04 --- /dev/null +++ b/lib/public/User/Backend/ILimitAwareCountUsersBackend.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\User\Backend; + +/** + * @since 31.0.0 + */ +interface ILimitAwareCountUsersBackend extends ICountUsersBackend { + /** + * @since 31.0.0 + * + * @param int $limit Limit to stop counting users if there are more than $limit. 0 to disable limiting. + * @return int|false The number of users (may be limited to $limit) on success false on failure + */ + public function countUsers(int $limit = 0): int|false; +} diff --git a/lib/public/User/Backend/IPasswordHashBackend.php b/lib/public/User/Backend/IPasswordHashBackend.php new file mode 100644 index 00000000000..2525b4e45ea --- /dev/null +++ b/lib/public/User/Backend/IPasswordHashBackend.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\User\Backend; + +use InvalidArgumentException; + +/** + * @since 30.0.0 + */ +interface IPasswordHashBackend { + /** + * @return ?string the password hash hashed by `\OCP\Security\IHasher::hash()` + * @since 30.0.0 + */ + public function getPasswordHash(string $userId): ?string; + + /** + * @param string $passwordHash the password hash hashed by `\OCP\Security\IHasher::hash()` + * @throws InvalidArgumentException when `$passwordHash` is not a valid hash + * @since 30.0.0 + */ + public function setPasswordHash(string $userId, string $passwordHash): bool; +} diff --git a/lib/public/User/Events/BeforeUserIdUnassignedEvent.php b/lib/public/User/Events/BeforeUserIdUnassignedEvent.php new file mode 100644 index 00000000000..2dee62521aa --- /dev/null +++ b/lib/public/User/Events/BeforeUserIdUnassignedEvent.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\User\Events; + +use OCP\EventDispatcher\Event; + +/** + * Emitted before removing the mapping between an external user and an internal userid + * @since 31.0.0 + */ +class BeforeUserIdUnassignedEvent extends Event { + /** + * @since 31.0.0 + */ + public function __construct( + private readonly string $userId, + ) { + parent::__construct(); + } + + /** + * @since 31.0.0 + */ + public function getUserId(): string { + return $this->userId; + } +} diff --git a/lib/public/User/Events/OutOfOfficeChangedEvent.php b/lib/public/User/Events/OutOfOfficeChangedEvent.php index b1cdb3abdd7..10865ef7ed5 100644 --- a/lib/public/User/Events/OutOfOfficeChangedEvent.php +++ b/lib/public/User/Events/OutOfOfficeChangedEvent.php @@ -21,7 +21,9 @@ class OutOfOfficeChangedEvent extends Event { /** * @since 28.0.0 */ - public function __construct(private IOutOfOfficeData $data) { + public function __construct( + private IOutOfOfficeData $data, + ) { parent::__construct(); } diff --git a/lib/public/User/Events/OutOfOfficeClearedEvent.php b/lib/public/User/Events/OutOfOfficeClearedEvent.php index 3eb8a9016e7..4153ce98ab5 100644 --- a/lib/public/User/Events/OutOfOfficeClearedEvent.php +++ b/lib/public/User/Events/OutOfOfficeClearedEvent.php @@ -21,7 +21,9 @@ class OutOfOfficeClearedEvent extends Event { /** * @since 28.0.0 */ - public function __construct(private IOutOfOfficeData $data) { + public function __construct( + private IOutOfOfficeData $data, + ) { parent::__construct(); } diff --git a/lib/public/User/Events/OutOfOfficeEndedEvent.php b/lib/public/User/Events/OutOfOfficeEndedEvent.php index e5cbc174d09..0817994f069 100644 --- a/lib/public/User/Events/OutOfOfficeEndedEvent.php +++ b/lib/public/User/Events/OutOfOfficeEndedEvent.php @@ -19,7 +19,9 @@ class OutOfOfficeEndedEvent extends Event { /** * @since 28.0.0 */ - public function __construct(private IOutOfOfficeData $data) { + public function __construct( + private IOutOfOfficeData $data, + ) { parent::__construct(); } diff --git a/lib/public/User/Events/OutOfOfficeScheduledEvent.php b/lib/public/User/Events/OutOfOfficeScheduledEvent.php index 0cf071baf59..f830d2af209 100644 --- a/lib/public/User/Events/OutOfOfficeScheduledEvent.php +++ b/lib/public/User/Events/OutOfOfficeScheduledEvent.php @@ -21,7 +21,9 @@ class OutOfOfficeScheduledEvent extends Event { /** * @since 28.0.0 */ - public function __construct(private IOutOfOfficeData $data) { + public function __construct( + private IOutOfOfficeData $data, + ) { parent::__construct(); } diff --git a/lib/public/User/Events/OutOfOfficeStartedEvent.php b/lib/public/User/Events/OutOfOfficeStartedEvent.php index 9550f5072e0..1b5c69b3cfb 100644 --- a/lib/public/User/Events/OutOfOfficeStartedEvent.php +++ b/lib/public/User/Events/OutOfOfficeStartedEvent.php @@ -19,7 +19,9 @@ class OutOfOfficeStartedEvent extends Event { /** * @since 28.0.0 */ - public function __construct(private IOutOfOfficeData $data) { + public function __construct( + private IOutOfOfficeData $data, + ) { parent::__construct(); } diff --git a/lib/public/User/Events/PasswordUpdatedEvent.php b/lib/public/User/Events/PasswordUpdatedEvent.php index 948b69e54b7..d3fd8f078fe 100644 --- a/lib/public/User/Events/PasswordUpdatedEvent.php +++ b/lib/public/User/Events/PasswordUpdatedEvent.php @@ -50,6 +50,13 @@ class PasswordUpdatedEvent extends Event { } /** + * @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 c5b8e11c888..9b74ff96063 100644 --- a/lib/public/User/Events/UserDeletedEvent.php +++ b/lib/public/User/Events/UserDeletedEvent.php @@ -34,4 +34,11 @@ class UserDeletedEvent extends Event { 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/UserIdAssignedEvent.php b/lib/public/User/Events/UserIdAssignedEvent.php new file mode 100644 index 00000000000..829bd50c0d0 --- /dev/null +++ b/lib/public/User/Events/UserIdAssignedEvent.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\User\Events; + +use OCP\EventDispatcher\Event; + +/** + * Emitted by backends (like user_ldap) when a user created externally is mapped for the first time and assigned a userid + * @since 31.0.0 + */ +class UserIdAssignedEvent extends Event { + /** + * @since 31.0.0 + */ + public function __construct( + private readonly string $userId, + ) { + parent::__construct(); + } + + /** + * @since 31.0.0 + */ + public function getUserId(): string { + return $this->userId; + } +} diff --git a/lib/public/User/Events/UserIdUnassignedEvent.php b/lib/public/User/Events/UserIdUnassignedEvent.php new file mode 100644 index 00000000000..128648a0753 --- /dev/null +++ b/lib/public/User/Events/UserIdUnassignedEvent.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\User\Events; + +use OCP\EventDispatcher\Event; + +/** + * Emitted after removing the mapping between an external user and an internal userid + * @since 31.0.0 + */ +class UserIdUnassignedEvent extends Event { + /** + * @since 31.0.0 + */ + public function __construct( + private readonly string $userId, + ) { + parent::__construct(); + } + + /** + * @since 31.0.0 + */ + public function getUserId(): string { + return $this->userId; + } +} diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php index 61a7b1f79cd..53f61073a59 100644 --- a/lib/public/User/Events/UserLoggedInEvent.php +++ b/lib/public/User/Events/UserLoggedInEvent.php @@ -46,6 +46,13 @@ class UserLoggedInEvent extends Event { } /** + * @since 31.0.0 + */ + public function getUid(): string { + return $this->user->getUID(); + } + + /** * @since 21.0.0 */ public function getLoginName(): string { diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php index c3a5bf90184..e3a4e2773bb 100644 --- a/lib/public/User/IOutOfOfficeData.php +++ b/lib/public/User/IOutOfOfficeData.php @@ -22,6 +22,8 @@ use OCP\IUser; * endDate: int, * shortMessage: string, * message: string, + * replacementUserId: ?string, + * replacementUserDisplayName: ?string * } * * @since 28.0.0 @@ -70,6 +72,20 @@ interface IOutOfOfficeData extends JsonSerializable { public function getMessage(): string; /** + * Get the replacement user id for auto responders and similar + * + * @since 30.0.0 + */ + public function getReplacementUserId(): ?string; + + /** + * Get the replacement user displayName for auto responders and similar + * + * @since 30.0.0 + */ + public function getReplacementUserDisplayName(): ?string; + + /** * @return OutOfOfficeData * * @since 28.0.0 |