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/time/src/rand.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/time/src/rand.rs')
| -rw-r--r-- | vendor/time/src/rand.rs | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/vendor/time/src/rand.rs b/vendor/time/src/rand.rs deleted file mode 100644 index 8e4098cb..00000000 --- a/vendor/time/src/rand.rs +++ /dev/null @@ -1,90 +0,0 @@ -//! Implementation of [`Distribution`] for various structs. - -use rand::distributions::{Distribution, Standard}; -use rand::Rng; - -use crate::{Date, Duration, Month, OffsetDateTime, PrimitiveDateTime, Time, UtcOffset, Weekday}; - -impl Distribution<Time> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Time { - Time::from_hms_nanos_ranged(rng.r#gen(), rng.r#gen(), rng.r#gen(), rng.r#gen()) - } -} - -impl Distribution<Date> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Date { - // Safety: The Julian day number is in range. - unsafe { - Date::from_julian_day_unchecked( - rng.gen_range(Date::MIN.to_julian_day()..=Date::MAX.to_julian_day()), - ) - } - } -} - -impl Distribution<UtcOffset> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UtcOffset { - UtcOffset::from_hms_ranged(rng.r#gen(), rng.r#gen(), rng.r#gen()) - } -} - -impl Distribution<PrimitiveDateTime> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> PrimitiveDateTime { - PrimitiveDateTime::new(Self.sample(rng), Self.sample(rng)) - } -} - -impl Distribution<OffsetDateTime> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> OffsetDateTime { - let date_time: PrimitiveDateTime = Self.sample(rng); - date_time.assume_offset(Self.sample(rng)) - } -} - -impl Distribution<Duration> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Duration { - Duration::new_ranged(rng.r#gen(), rng.r#gen()) - } -} - -impl Distribution<Weekday> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Weekday { - use Weekday::*; - - match rng.gen_range(0u8..7) { - 0 => Monday, - 1 => Tuesday, - 2 => Wednesday, - 3 => Thursday, - 4 => Friday, - 5 => Saturday, - val => { - debug_assert!(val == 6); - Sunday - } - } - } -} - -impl Distribution<Month> for Standard { - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Month { - use Month::*; - match rng.gen_range(1u8..=12) { - 1 => January, - 2 => February, - 3 => March, - 4 => April, - 5 => May, - 6 => June, - 7 => July, - 8 => August, - 9 => September, - 10 => October, - 11 => November, - val => { - debug_assert!(val == 12); - December - } - } - } -} |
