diff options
Diffstat (limited to 'lib/public/User/Backend')
-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 |
4 files changed, 55 insertions, 1 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; +} |