diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-15 16:37:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-17 16:30:22 -0600 |
| commit | 45df4d0d9b577fecee798d672695fe24ff57fb1b (patch) | |
| tree | 1b99bf645035b58e0d6db08c7a83521f41f7a75b /vendor/writeable/src/parts_write_adapter.rs | |
| parent | f94f79608393d4ab127db63cc41668445ef6b243 (diff) | |
feat: migrate from Cedar to SpiceDB authorization system
This is a major architectural change that replaces the Cedar policy-based
authorization system with SpiceDB's relation-based authorization.
Key changes:
- Migrate from Rust to Go implementation
- Replace Cedar policies with SpiceDB schema and relationships
- Switch from envoy `ext_authz` with Cedar to SpiceDB permission checks
- Update build system and dependencies for Go ecosystem
- Maintain Envoy integration for external authorization
This change enables more flexible permission modeling through SpiceDB's
Google Zanzibar inspired relation-based system, supporting complex
hierarchical permissions that were difficult to express in Cedar.
Breaking change: Existing Cedar policies and Rust-based configuration
will no longer work and need to be migrated to SpiceDB schema.
Diffstat (limited to 'vendor/writeable/src/parts_write_adapter.rs')
| -rw-r--r-- | vendor/writeable/src/parts_write_adapter.rs | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/vendor/writeable/src/parts_write_adapter.rs b/vendor/writeable/src/parts_write_adapter.rs deleted file mode 100644 index eacf3a2c..00000000 --- a/vendor/writeable/src/parts_write_adapter.rs +++ /dev/null @@ -1,115 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use crate::*; - -/// A wrapper around a type implementing [`fmt::Write`] that implements [`PartsWrite`]. -#[derive(Debug)] -#[allow(clippy::exhaustive_structs)] // newtype -pub struct CoreWriteAsPartsWrite<W: fmt::Write + ?Sized>(pub W); - -impl<W: fmt::Write + ?Sized> fmt::Write for CoreWriteAsPartsWrite<W> { - #[inline] - fn write_str(&mut self, s: &str) -> fmt::Result { - self.0.write_str(s) - } - - #[inline] - fn write_char(&mut self, c: char) -> fmt::Result { - self.0.write_char(c) - } -} - -impl<W: fmt::Write + ?Sized> PartsWrite for CoreWriteAsPartsWrite<W> { - type SubPartsWrite = CoreWriteAsPartsWrite<W>; - - #[inline] - fn with_part( - &mut self, - _part: Part, - mut f: impl FnMut(&mut Self::SubPartsWrite) -> fmt::Result, - ) -> fmt::Result { - f(self) - } -} - -/// A [`Writeable`] that writes out the given part. -/// -/// # Examples -/// -/// ``` -/// use writeable::adapters::WithPart; -/// use writeable::assert_writeable_parts_eq; -/// use writeable::Part; -/// -/// // Simple usage: -/// -/// const PART: Part = Part { -/// category: "foo", -/// value: "bar", -/// }; -/// -/// assert_writeable_parts_eq!( -/// WithPart { -/// writeable: "Hello World", -/// part: PART -/// }, -/// "Hello World", -/// [(0, 11, PART)], -/// ); -/// -/// // Can be nested: -/// -/// const PART2: Part = Part { -/// category: "foo2", -/// value: "bar2", -/// }; -/// -/// assert_writeable_parts_eq!( -/// WithPart { -/// writeable: WithPart { -/// writeable: "Hello World", -/// part: PART -/// }, -/// part: PART2 -/// }, -/// "Hello World", -/// [(0, 11, PART), (0, 11, PART2)], -/// ); -/// ``` -#[derive(Debug)] -#[allow(clippy::exhaustive_structs)] // public adapter -pub struct WithPart<T: ?Sized> { - pub part: Part, - pub writeable: T, -} - -impl<T: Writeable + ?Sized> Writeable for WithPart<T> { - #[inline] - fn write_to<W: fmt::Write + ?Sized>(&self, sink: &mut W) -> fmt::Result { - self.writeable.write_to(sink) - } - - #[inline] - fn write_to_parts<W: PartsWrite + ?Sized>(&self, sink: &mut W) -> fmt::Result { - sink.with_part(self.part, |w| self.writeable.write_to_parts(w)) - } - - #[inline] - fn writeable_length_hint(&self) -> LengthHint { - self.writeable.writeable_length_hint() - } - - #[inline] - fn write_to_string(&self) -> Cow<str> { - self.writeable.write_to_string() - } -} - -impl<T: Writeable + ?Sized> fmt::Display for WithPart<T> { - #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - Writeable::write_to(&self, f) - } -} |
