Skip to content

Commit

Permalink
only check file ids when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
billyb2 committed Aug 18, 2024
1 parent e4d9d3a commit c3586c2
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ pub fn authorize(
))
.unwrap();

if !file_ids.is_empty() {
let auth_file_ids = set(file_ids
.iter()
.map(|id| string(id))
.collect::<BTreeSet<_>>());

authorizer
.add_fact(biscuit_auth::builder::fact(
"file_ids",
&[auth_file_ids.clone()],
))
.unwrap();
}
let auth_file_ids = set(file_ids
.iter()
.map(|id| string(id))
.collect::<BTreeSet<_>>());

authorizer
.add_fact(biscuit_auth::builder::fact(
"file_ids",
&[auth_file_ids.clone()],
))
.unwrap();

authorizer.authorize().unwrap();

Expand Down

0 comments on commit c3586c2

Please sign in to comment.