diff --git a/astroplant-api/src/authorization/mod.rs b/astroplant-api/src/authorization/mod.rs index b253d22..5f29ee5 100644 --- a/astroplant-api/src/authorization/mod.rs +++ b/astroplant-api/src/authorization/mod.rs @@ -98,12 +98,12 @@ impl Permission for UserAction { fn permitted(self, acting_user: &Option, 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), } } }