JTHUFYTDQHWNQV5EVGIDMLSNA7OOPBHD52LHHCDYOMLIIWHD7AUAC
let user_permissions: Vec<Permission> = self.db.query(r#"SELECT id, aspect FROM permission WHERE ->granted->user == type::thing("user", $id)"#).bind(("id", user.id.clone())).await?.take(0)?;
let user_permissions: Vec<Permission> = self
.db
.query(r#"SELECT id, aspect, ->granted->user FROM permission WHERE user == $id"#)
.bind(("id", user.id.clone()))
.await?
.take(0)?;
Ok(HashSet::new())
let group_permissions: Vec<Permission> = self.db.query(r#"SELECT id, aspect, ->granted->group<-member_of<-user FROM permission WHERE user == $id"#).bind(("id", user.id.clone())).await?.take(0)?;
Ok(group_permissions.into_iter().collect())
DEFINE FIELD subject ON TABLE permission TYPE option<record>;
DEFINE TABLE group SCHEMAFULL;
DEFINE FIELD description ON TABLE group TYPE string;
DEFINE TABLE member_of SCHEMAFULL;
DEFINE FIELD in ON TABLE member_of TYPE record<user>;
DEFINE FIELD out ON TABLE member_of TYPE record<group>;