Skip to main content

EnforceablePolicy

Trait EnforceablePolicy 

Source
pub(crate) trait EnforceablePolicy: Policy {
    // Required methods
    fn get_enforced(
        &self,
        organization_id: OrganizationId,
        policy_views: &[PolicyView],
        organization_user_policy_contexts: &[OrganizationUserPolicyContext],
    ) -> EnforcedPolicy<Self>
       where Self: Sized;
    fn get_all_enforced(
        &self,
        policy_views: &[PolicyView],
        organization_user_policy_contexts: &[OrganizationUserPolicyContext],
    ) -> Vec<EnforcedPolicy<Self>>
       where Self: Sized;
}
Expand description

Evaluates whether a Policy is enforced against the current user.

Required Methods§

Source

fn get_enforced( &self, organization_id: OrganizationId, policy_views: &[PolicyView], organization_user_policy_contexts: &[OrganizationUserPolicyContext], ) -> EnforcedPolicy<Self>
where Self: Sized,

Constructs a new EnforcedPolicy for a specific organization, evaluating whether the policy should be enforced against the user or not.

If the organization context is missing for the corresponding organization, it will be enforced by default (err on the side of enforcement).

Source

fn get_all_enforced( &self, policy_views: &[PolicyView], organization_user_policy_contexts: &[OrganizationUserPolicyContext], ) -> Vec<EnforcedPolicy<Self>>
where Self: Sized,

Constructs a new EnforcedPolicy for all the user’s organization, evaluating whether each organization’s policy should be enforced against the user or not.

This will always return an EnforcedPolicy for each organization.

Implementors§