Add API tokens support #9

Merged
pierre merged 40 commits from api into master 2024-04-23 17:04:45 +00:00
Showing only changes of commit 631cc96537 - Show all commits

View File

@ -21,7 +21,7 @@ impl TokenID {
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
pub struct TokenRight { pub struct TokenRight {
verb: TokenVerb, verb: TokenVerb,
uri: String, path: String,
} }
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
@ -108,7 +108,7 @@ pub struct NewToken {
impl TokenRights { impl TokenRights {
pub fn check_error(&self) -> Option<&'static str> { pub fn check_error(&self) -> Option<&'static str> {
for r in &self.0 { for r in &self.0 {
if !r.uri.starts_with("/api/") { if !r.path.starts_with("/api/") {
return Some("All API rights shall start with /api/"); return Some("All API rights shall start with /api/");
} }
} }