MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / policy_exists

Method policy_exists

nodedb/src/control/security/rls/replication.rs:51–58  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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}

Callers 3

create_rls_policyFunction · 0.80
drop_rls_policyFunction · 0.80
try_dispatch_guardsFunction · 0.80

Calls 4

policy_keyFunction · 0.85
lock_readMethod · 0.80
getMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected