Added possibility to list all available API keys at the user settings page

This commit is contained in:
Jan Böhmer 2023-08-19 23:19:21 +02:00
parent 040e86ea6d
commit 35a0e8464a
9 changed files with 245 additions and 42 deletions

View file

@ -37,10 +37,14 @@ enum ApiTokenLevel: int
* The token can read and edit (non-sensitive) data.
*/
case EDIT = 2;
/**
* The token can do some administrative tasks (like viewing all log entries), but can not change passwords and create new tokens.
*/
case ADMIN = 3;
/**
* The token can do everything the user can do.
*/
case FULL = 3;
case FULL = 4;
/**
* Returns the additional roles that the authenticated user should have when using this token.
@ -55,4 +59,13 @@ enum ApiTokenLevel: int
self::FULL => [self::ROLE_READ_ONLY, self::ROLE_EDIT, self::ROLE_FULL],
};
}
/**
* Returns the translation key for the name of this token level.
* @return string
*/
public function getTranslationKey(): string
{
return 'api_token.level.' . strtolower($this->name);
}
}