Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_sql.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Repository/UserRepository.php')
-rw-r--r--lib/Repository/UserRepository.php35
1 files changed, 25 insertions, 10 deletions
diff --git a/lib/Repository/UserRepository.php b/lib/Repository/UserRepository.php
index f3e3fbb..aa87f8a 100644
--- a/lib/Repository/UserRepository.php
+++ b/lib/Repository/UserRepository.php
@@ -55,22 +55,37 @@ class UserRepository
/**
* Get an user entity object.
*
- * @param string $uid The user ID.
+ * @param mixed $uid The user ID.
+ *
+ * @return User The user entity, NULL if it does not exists or
+ * FALSE on failure.
+ */
+ public function findByUid($uid)
+ {
+ return $this->dataQuery->queryEntity(
+ Query::FIND_USER_BY_UID, User::class, [Query::UID_PARAM => $uid]
+ );
+ }
+
+ /**
+ * Get an user entity object.
+ *
+ * @param string $username The username.
* @param bool $caseSensitive TRUE for case sensitive search,
* FALSE for case insensitive search.
*
* @return User The user entity, NULL if it does not exists or
* FALSE on failure.
*/
- public function findByUid($uid, $caseSensitive = true)
+ public function findByUsername($username, $caseSensitive = true)
{
if ($caseSensitive) {
return $this->dataQuery->queryEntity(
- Query::FIND_USER, User::class, [Query::UID_PARAM => $uid]
+ Query::FIND_USER_BY_USERNAME, User::class, [Query::USERNAME_PARAM => $username]
);
} else {
return $this->dataQuery->queryEntity(
- Query::FIND_USER_CASE_INSENSITIVE, User::class, [Query::UID_PARAM => $uid]
+ Query::FIND_USER_BY_USERNAME_CASE_INSENSITIVE, User::class, [Query::USERNAME_PARAM => $username]
);
}
}
@@ -78,24 +93,24 @@ class UserRepository
/**
* Get an user entity object.
*
- * @param string $query The user ID or email address.
+ * @param string $query The username or email address.
* @param bool $caseSensitive TRUE for case sensitive search,
* FALSE for case insensitive search.
*
* @return User The user entity, NULL if it does not exists or
* FALSE on failure.
*/
- public function findByUidOrEmail($query, $caseSensitive = true)
+ public function findByUsernameOrEmail($query, $caseSensitive = true)
{
if ($caseSensitive) {
return $this->dataQuery->queryEntity(
- Query::FIND_USER_BY_UID_OR_EMAIL, User::class,
- [Query::UID_PARAM => $query, Query::EMAIL_PARAM => $query]
+ Query::FIND_USER_BY_USERNAME_OR_EMAIL, User::class,
+ [Query::USERNAME_PARAM => $query, Query::EMAIL_PARAM => $query]
);
} else {
return $this->dataQuery->queryEntity(
- Query::FIND_USER_BY_UID_OR_EMAIL_CASE_INSENSITIVE, User::class,
- [Query::UID_PARAM => $query, Query::EMAIL_PARAM => $query]
+ Query::FIND_USER_BY_USERNAME_OR_EMAIL_CASE_INSENSITIVE, User::class,
+ [Query::USERNAME_PARAM => $query, Query::EMAIL_PARAM => $query]
);
}
}