Remove a parent→child edge from the hierarchy.
(&mut self, tenant_id: u64, child_id: &str)
| 85 | |
| 86 | /// Remove a parent→child edge from the hierarchy. |
| 87 | pub fn remove_edge(&mut self, tenant_id: u64, child_id: &str) { |
| 88 | let Some(tenant) = self.tenants.get_mut(&tenant_id) else { |
| 89 | return; |
| 90 | }; |
| 91 | if let Some(old_parent) = tenant.parent_map.remove(child_id) |
| 92 | && let Some(children) = tenant.children_map.get_mut(&old_parent) |
| 93 | { |
| 94 | children.remove(child_id); |
| 95 | if children.is_empty() { |
| 96 | tenant.children_map.remove(&old_parent); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /// Load a permission grant into the cache. |
| 102 | pub fn put_grant(&mut self, tenant_id: u64, grant: &PermissionGrant) { |