| 494 | } |
| 495 | |
| 496 | fn match_ordering<T: FromStr + PartialOrd>(&self, user: &FPUser, predicate: &str) -> bool { |
| 497 | if let Some(c) = user.get(&self.subject) { |
| 498 | let c: T = match c.parse() { |
| 499 | Ok(v) => v, |
| 500 | Err(_) => return false, |
| 501 | }; |
| 502 | return match predicate { |
| 503 | "=" => self.do_match::<T>(&c, |c, o| c.eq(o)), |
| 504 | "!=" => !self.match_ordering::<T>(user, "="), |
| 505 | ">" => self.do_match::<T>(&c, |c, o| c.gt(o)), |
| 506 | ">=" => self.do_match::<T>(&c, |c, o| c.ge(o)), |
| 507 | "<" => self.do_match::<T>(&c, |c, o| c.lt(o)), |
| 508 | "<=" => self.do_match::<T>(&c, |c, o| c.le(o)), |
| 509 | _ => { |
| 510 | info!("unknown predicate {}", predicate); |
| 511 | false |
| 512 | } |
| 513 | }; |
| 514 | } |
| 515 | info!("user attr missing: {}", self.subject); |
| 516 | false |
| 517 | } |
| 518 | |
| 519 | fn match_timestamp(&self, user: &FPUser, predicate: &str) -> bool { |
| 520 | let c: u128 = match user.get(&self.subject) { |