Add API tokens support #9
@ -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/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user