Caching current user
This commit is contained in:
parent
f756eab00d
commit
cafb7ad654
@ -42,6 +42,8 @@ class APnutI
|
|||||||
protected string $token_redirect_after_auth;
|
protected string $token_redirect_after_auth;
|
||||||
protected ?string $server_token_file_path = null;
|
protected ?string $server_token_file_path = null;
|
||||||
|
|
||||||
|
protected ?User $current_user = null;
|
||||||
|
|
||||||
public ?Meta $meta = null;
|
public ?Meta $meta = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -383,6 +385,7 @@ class APnutI
|
|||||||
{
|
{
|
||||||
unset($_SESSION[$this->token_session_key]);
|
unset($_SESSION[$this->token_session_key]);
|
||||||
$this->access_token = null;
|
$this->access_token = null;
|
||||||
|
$this->current_user = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -539,7 +542,8 @@ class APnutI
|
|||||||
|
|
||||||
public function getAuthorizedUser(): User
|
public function getAuthorizedUser(): User
|
||||||
{
|
{
|
||||||
return new User($this->get('/users/me'), $this);
|
$this->current_user ??= new User($this->get('/users/me'), $this);
|
||||||
|
return $this->current_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUser(int $user_id, array $args = [])
|
public function getUser(int $user_id, array $args = [])
|
||||||
|
Loading…
Reference in New Issue
Block a user