Check whether a policy with the given name already exists on the given (tenant, collection). Used by the handler pre-check before proposing `PutRlsPolicy`.
(&self, tenant_id: u64, collection: &str, policy_name: &str)
| 49 | /// on the given (tenant, collection). Used by the handler |
| 50 | /// pre-check before proposing `PutRlsPolicy`. |
| 51 | pub fn policy_exists(&self, tenant_id: u64, collection: &str, policy_name: &str) -> bool { |
| 52 | let key = policy_key(tenant_id, collection); |
| 53 | let policies = self.lock_read(); |
| 54 | policies |
| 55 | .get(&key) |
| 56 | .map(|list| list.iter().any(|p| p.name == policy_name)) |
| 57 | .unwrap_or(false) |
| 58 | } |
| 59 | } |
no test coverage detected