Skip to content

Commit

Permalink
no sub
Browse files Browse the repository at this point in the history
  • Loading branch information
barthalion committed Feb 15, 2025
1 parent ce6bcca commit a8433ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/api/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ async fn handle_prune_async(
db: web::Data<Db>,
req: HttpRequest,
) -> Result<HttpResponse, ApiError> {
// Verify token has TokenManagement scope
req.has_token_claims("", ClaimsScope::TokenManagement)?;
req.validate_claims(|claims| {
if !claims.scope.contains(&ClaimsScope::TokenManagement) {
return Err(ApiError::token_insufficient("Missing TokenManagement scope"));
}
Ok(())
})?;

// Create a new prune job
let job = db.get_ref().start_prune_job(args.repo.clone()).await?;
Expand Down
1 change: 0 additions & 1 deletion tests/run-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def exec(cmd):
"--secret=secret",
"--repo=stable",
"--scope=tokenmanagement",
"--sub=prune-test",
]
)
exec(["./flat-manager-client", "prune", "http://127.0.0.1:8080", "stable"])

0 comments on commit a8433ad

Please sign in to comment.