*
* This program is free software: you can redistribute it and/or modify
@@ -75,6 +75,31 @@ class UserRepository
}
}
+ /**
+ * Get an user entity object.
+ *
+ * @param string $query The user ID 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)
+ {
+ if ($caseSensitive) {
+ return $this->dataQuery->queryEntity(
+ Query::FIND_USER_BY_UID_OR_EMAIL, User::class,
+ [Query::UID_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]
+ );
+ }
+ }
+
/**
* Get an array of user entity objects.
*
diff --git a/templates/admin.php b/templates/admin.php
index 7678830..add76e1 100644
--- a/templates/admin.php
+++ b/templates/admin.php
@@ -110,6 +110,7 @@ function print_select_options(
t("Here are all currently supported options.")); ?>