From eb92f823c31a5e702af7005231f0d6915aad3342 Mon Sep 17 00:00:00 2001 From: benj Date: Mon, 24 Apr 2023 13:24:45 -0700 Subject: email templates, sendgrid, creds, and some experimental things Started playing with namespace configs and integrating with zanzibar impls. Still lot's of experimenting and dead code going on. --- crates/secd/src/auth/z.rs | 61 ----------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 crates/secd/src/auth/z.rs (limited to 'crates/secd/src/auth/z.rs') diff --git a/crates/secd/src/auth/z.rs b/crates/secd/src/auth/z.rs deleted file mode 100644 index 31f449c..0000000 --- a/crates/secd/src/auth/z.rs +++ /dev/null @@ -1,61 +0,0 @@ -use uuid::Uuid; - -use crate::{Secd, SecdError}; - -pub type Namespace = String; -pub type Object = (Namespace, Uuid); -pub type Relation = String; - -pub struct Relationship { - pub subject: Subject, - pub object: Object, - pub relation: Relation, -} - -#[derive(Clone)] -pub enum Subject { - User(Object), - UserSet { user: Object, relation: Relation }, -} - -impl Secd { - pub async fn check(&self, r: &Relationship) -> Result { - let spice = self - .spice - .clone() - .expect("TODO: only supports postgres right now"); - - Ok(spice.check_permission(r).await?) - } - pub async fn expand(&self) -> Result<(), SecdError> { - todo!() - } - pub async fn read(&self) -> Result<(), SecdError> { - todo!() - } - pub async fn watch(&self) -> Result<(), SecdError> { - unimplemented!() - } - pub async fn write(&self, ts: &[Relationship]) -> Result<(), SecdError> { - let spice = self - .spice - .clone() - .expect("TODO: only supports postgres right now"); - - // Since spice doesn't really have a great schema pattern, we - // prefix all incoming write relationships with an r_ to indicate - // they are "relationships" rather than what spice calls permissions - spice - .write_relationship( - &ts.into_iter() - .map(|r| Relationship { - subject: r.subject.clone(), - object: r.object.clone(), - relation: format!("r_{}", r.relation), - }) - .collect::>(), - ) - .await?; - Ok(()) - } -} -- cgit v1.2.3