Skip to content

Commit

Permalink
fix: correctly calculate user permissions for logged-in users
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcur committed Jan 19, 2024
1 parent 3e24eb7 commit c0ba319
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions astroplant-api/src/authorization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ impl Permission for UserAction {

fn permitted(self, acting_user: &Option<User>, object_user: &User) -> bool {
use UserAction::*;
match acting_user {
Some(acting_user) => acting_user == object_user,
None => match self {
View | ListKitMemberships => true,
EditDetails => false,
},
match self {
View | ListKitMemberships => true,
EditDetails => acting_user
.as_ref()
.map(|acting_user| acting_user == object_user)
.unwrap_or(false),
}
}
}

0 comments on commit c0ba319

Please sign in to comment.