Skip to main content

AuthorizationPolicy

Struct AuthorizationPolicy 

Source
pub struct AuthorizationPolicy { /* private fields */ }

Implementations§

Source§

impl AuthorizationPolicy

Source

pub fn decide_accepted_work( &self, request: AuthorizationRequest, existing: Option<&AuthorizationDecision>, accepted: &AuthorizationDecision, now: OffsetDateTime, ttl: AuthorizationDecisionTtl, ) -> Result<AuthorizationDecisionPlan, DomainError>

Admit completion of work whose original authorization is sealed in a durable domain record. The current evidence remains tied to the exact principal, scope and admission decision even after grant revocation.

Source§

impl AuthorizationPolicy

Source

pub fn empty() -> Self

Source

pub fn rehydrate( events: &[AuthorizationPolicyEvent], ) -> Result<Self, DomainError>

Source

pub const fn version(&self) -> AuthorizationPolicyVersion

Source

pub fn id(&self) -> Option<&AuthorizationPolicyId>

Source

pub fn owner(&self) -> Option<&AuthenticatedPrincipal>

Source

pub fn decisions(&self) -> impl Iterator<Item = &AuthorizationDecision>

Source

pub fn grants(&self) -> impl Iterator<Item = &AuthorizationGrant>

Source

pub fn revoked_grant_ids(&self) -> impl Iterator<Item = &AuthorizationGrantId>

Source

pub fn separation_rules(&self) -> impl Iterator<Item = SeparationRule> + '_

Source

pub fn decide_open( &self, policy_id: AuthorizationPolicyId, owner: AuthenticatedPrincipal, separation_rules: Vec<SeparationRule>, opened_at: OffsetDateTime, ) -> Result<Option<AuthorizationPolicyEvent>, DomainError>

Source

pub fn decide_authorize( &self, request: AuthorizationRequest, now: OffsetDateTime, ttl: AuthorizationDecisionTtl, ) -> Result<AuthorizationDecisionPlan, DomainError>

Source

pub fn decide_authorize_with_decisions( &self, request: AuthorizationRequest, existing: Option<&AuthorizationDecision>, approval: Option<&AuthorizationDecision>, now: OffsetDateTime, ttl: AuthorizationDecisionTtl, ) -> Result<AuthorizationDecisionPlan, DomainError>

Source

pub fn decide_issue( &self, issuer: &AuthenticatedPrincipal, grant: AuthorizationGrant, now: OffsetDateTime, ) -> Result<Option<AuthorizationPolicyEvent>, DomainError>

Source

pub fn decide_revoke( &self, issuer: &AuthenticatedPrincipal, grant_id: &AuthorizationGrantId, reason: AuthorizationRevocationReason, now: OffsetDateTime, ) -> Result<Option<AuthorizationPolicyEvent>, DomainError>

Source

pub fn permits( &self, principal: &AuthenticatedPrincipal, action: AuthorizationAction, scope: &AuthorizationScope, now: OffsetDateTime, ) -> bool

Source

pub fn apply( &mut self, event: AuthorizationPolicyEvent, ) -> Result<(), DomainError>

Source

pub fn apply_projected( &mut self, event: AuthorizationPolicyEvent, approval: Option<&AuthorizationDecision>, ) -> Result<(), DomainError>

Source

pub fn apply_projected_with_authorities( &mut self, event: AuthorizationPolicyEvent, approval: Option<&AuthorizationDecision>, accepted: Option<&AuthorizationDecision>, ) -> Result<(), DomainError>

Source

pub fn restore_version( &mut self, version: AuthorizationPolicyVersion, ) -> Result<(), DomainError>

Trait Implementations§

Source§

impl Clone for AuthorizationPolicy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuthorizationPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AuthorizationPolicy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AuthorizationPolicy

Source§

impl PartialEq for AuthorizationPolicy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AuthorizationPolicy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.