pub(crate) struct EnforcedPolicy<P: Policy> {
pub organization_id: OrganizationId,
pub data: P::Data,
pub enforced: bool,
}Expand description
A per-organization enforcement decision for a single policy type.
Unlike PolicyView (the server-side record), this carries only the
fields relevant to an enforcement decision: enforced reflects the
user-specific evaluation rather than the policy’s raw enabled flag, and
data is strongly typed via Policy::Data.
data is always populated. It is Default::default() whenever the policy
is not enforced against the user, when no matching policy is found, or when
the policy record’s data could not be parsed.
Fields§
§organization_id: OrganizationIdThe organization this enforcement decision is for.
data: P::DataThe policy data, if any.
enforced: boolWhether the policy should be enforced against the current user for this organization.
Implementations§
Source§impl<P: Policy> EnforcedPolicy<P>
impl<P: Policy> EnforcedPolicy<P>
Sourcepub(crate) fn not_enforced(organization_id: OrganizationId) -> Self
pub(crate) fn not_enforced(organization_id: OrganizationId) -> Self
The decision for an organization that has no matching policy: not
enforced, with Default data.
Sourcepub(crate) fn into_erased(self, policy: &P) -> EnforcedPolicyErased
pub(crate) fn into_erased(self, policy: &P) -> EnforcedPolicyErased
Consumes this decision into its FFI-friendly form, erasing the
strongly-typed data into a PolicyDataType via Policy::to_erased.
Trait Implementations§
Source§impl<P: Clone + Policy> Clone for EnforcedPolicy<P>
impl<P: Clone + Policy> Clone for EnforcedPolicy<P>
Source§fn clone(&self) -> EnforcedPolicy<P>
fn clone(&self) -> EnforcedPolicy<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<P: Policy> StructuralPartialEq for EnforcedPolicy<P>
Auto Trait Implementations§
impl<P> Freeze for EnforcedPolicy<P>
impl<P> RefUnwindSafe for EnforcedPolicy<P>
impl<P> Send for EnforcedPolicy<P>
impl<P> Sync for EnforcedPolicy<P>
impl<P> Unpin for EnforcedPolicy<P>
impl<P> UnsafeUnpin for EnforcedPolicy<P>
impl<P> UnwindSafe for EnforcedPolicy<P>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more