mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Added possibility to list all available API keys at the user settings page
This commit is contained in:
parent
040e86ea6d
commit
35a0e8464a
9 changed files with 245 additions and 42 deletions
|
@ -315,11 +315,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $saml_user = false;
|
||||
|
||||
/**
|
||||
* @var ApiToken|null The api token which is used to authenticate the user, or null if the user is not authenticated via api token
|
||||
*/
|
||||
private ?ApiToken $authenticating_api_token = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new ArrayCollection();
|
||||
|
@ -1013,7 +1008,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Return all API tokens of the user.
|
||||
* @return Collection
|
||||
* @return Collection<int, ApiToken>
|
||||
*/
|
||||
public function getApiTokens(): Collection
|
||||
{
|
||||
|
@ -1039,24 +1034,4 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
{
|
||||
$this->api_tokens->removeElement($apiToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the user as authenticated with an API token, should only be used by the API token authenticator.
|
||||
* @param ApiToken $apiToken
|
||||
* @return void
|
||||
*/
|
||||
public function markAsApiTokenAuthenticated(ApiToken $apiToken): void
|
||||
{
|
||||
$this->authenticating_api_token = $apiToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the API token that is currently authenticating the user or null if the user is not authenticated with an API token.
|
||||
* @return ApiToken|null
|
||||
*/
|
||||
public function getAuthenticatingApiToken(): ?ApiToken
|
||||
{
|
||||
return $this->authenticating_api_token;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue