diff --git a/common/src/subscription.rs b/common/src/subscription.rs index d93296e..b00022e 100644 --- a/common/src/subscription.rs +++ b/common/src/subscription.rs @@ -265,6 +265,14 @@ impl PrincsFilter { }) } + pub fn eval(&self, principal: &str) -> bool { + match self.operation { + None => true, + Some(PrincsFilterOperation::Only) => self.princs.contains(principal), + Some(PrincsFilterOperation::Except) => !self.princs.contains(principal), + } + } + pub fn princ_literals(&self) -> &HashSet { &self.princs } @@ -811,13 +819,7 @@ impl SubscriptionData { return false; } - match self.princs_filter().operation { - None => true, - Some(PrincsFilterOperation::Only) => self.princs_filter().princ_literals().contains(principal), - Some(PrincsFilterOperation::Except) => { - !self.princs_filter().princ_literals().contains(principal) - } - } + self.princs_filter().eval(principal) } pub fn revision(&self) -> Option<&String> {