Yordis Prieto
04/09/2026, 2:46 PMyetitwo
04/09/2026, 2:48 PMyetitwo
04/09/2026, 2:48 PMyetitwo
04/09/2026, 2:48 PMyetitwo
04/09/2026, 2:49 PMyetitwo
04/09/2026, 2:51 PMYordis Prieto
04/09/2026, 2:51 PMyetitwo
04/09/2026, 2:51 PMyetitwo
04/09/2026, 2:52 PMYordis Prieto
04/09/2026, 2:52 PMyetitwo
04/09/2026, 2:52 PMYordis Prieto
04/09/2026, 2:52 PMYordis Prieto
04/09/2026, 2:52 PMyetitwo
04/09/2026, 2:53 PMYordis Prieto
04/09/2026, 2:53 PMYordis Prieto
04/09/2026, 2:53 PMYordis Prieto
04/09/2026, 2:54 PMJoey
04/09/2026, 3:35 PMYordis Prieto
04/09/2026, 4:03 PMbuf and, well, no external so I dont have to deal with trusting releasesJoey
04/09/2026, 4:03 PMYordis Prieto
04/09/2026, 4:03 PMJoey
04/09/2026, 4:03 PMYordis Prieto
04/09/2026, 4:03 PMYordis Prieto
04/09/2026, 4:04 PMhttps://tenor.com/5LZw.gifâ–¾
Joey
04/09/2026, 4:04 PMJoey
04/09/2026, 4:04 PMlet client = SpiceDBClient::new_plaintext("localhost:50051", "somerandomkeyhere")
.await
.expect("failed to create client");
// Write schema
client
.write_schema(SCHEMA)
.await
.expect("write schema failed");
// Write test data: alice is a viewer of firstdoc
let rel = Relationship::new("document", "firstdoc", "viewer", "user", "alice", "")
.expect("invalid relationship");
let mut txn = Transaction::new();
txn.touch(&rel);
let revision = client.write(&txn).await.expect("write relationships failed");
// Check permission: alice should be able to view firstdoc
let check_rel = Relationship::new("document", "firstdoc", "view", "user", "alice", "")
.expect("invalid relationship");
let result = client
.check_permission(&consistency::at_least(&revision), "view", &check_rel)
.await
.expect("check failed");
println!("alice can view document:firstdoc: {}", result.has_permission);
assert!(result.has_permission, "expected alice to have view permission");Yordis Prieto
04/09/2026, 4:05 PMYordis Prieto
04/09/2026, 4:06 PMYordis Prieto
04/09/2026, 4:07 PMJoey
04/09/2026, 4:07 PMJoey
04/09/2026, 4:07 PMYordis Prieto
04/09/2026, 4:08 PM0x2A
04/10/2026, 6:08 AM