From 3406b370fe290559ff2445097a380d6f48d0f9af Mon Sep 17 00:00:00 2001 From: benj Date: Mon, 12 Jun 2023 15:39:10 -0700 Subject: 🤮: add check_list_namespaces as a temporary hack while using spice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/secd/src/auth/z/mod.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'crates/secd/src/auth') diff --git a/crates/secd/src/auth/z/mod.rs b/crates/secd/src/auth/z/mod.rs index d663e65..d64f674 100644 --- a/crates/secd/src/auth/z/mod.rs +++ b/crates/secd/src/auth/z/mod.rs @@ -32,13 +32,24 @@ impl Authorization for Secd { Ok(spice.check_permission(r).await?) } - async fn expand(&self) -> Result<(), SecdError> { - todo!() - } - async fn read(&self) -> Result<(), SecdError> { - todo!() + async fn check_list_namespaces( + &self, + ns: &Namespace, + subj: &Subject, + relation: &Relation, + ) -> Result, SecdError> { + let spice = self + .spice + .clone() + .expect("TODO: only supports postgres right now"); + Ok(spice + .lookup_resources(ns, relation, subj) + .await? + .iter() + .map(|e| Uuid::parse_str(e).unwrap()) + .collect()) } - async fn watch(&self) -> Result<(), SecdError> { + async fn check_list_subjects(&self) -> Result, SecdError> { unimplemented!() } async fn write(&self, ts: &[Relationship]) -> Result<(), SecdError> { -- cgit v1.2.3