Skip to content

Commit 3bd5f8a

Browse files
committed
add getUserByWebId function
1 parent ed05a31 commit 3bd5f8a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/User.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ public static function getUserById($userId) {
249249
return false;
250250
}
251251

252+
public static function getUserByWebId($webId) {
253+
$idParts = explode(".", $webId, 2);
254+
if ($idParts[1] !== BASEDOMAIN . "/#me") {
255+
return false;
256+
}
257+
$userId = preg_replace("/^id-/", "", $idParts[0]);
258+
return self::getUserById($userId);
259+
}
260+
252261
public static function checkPassword($email, $password) {
253262
Db::connect();
254263
$query = Db::$pdo->prepare(

0 commit comments

Comments
 (0)