Skip to main content

Policy

Trait Policy 

Source
pub(crate) trait Policy:
    Send
    + Sync
    + 'static {
    type Data: Default + DeserializeOwned;

    // Required methods
    fn policy_type(&self) -> PolicyType;
    fn to_erased(&self, data: Self::Data) -> PolicyDataType;

    // Provided methods
    fn exempt_roles(&self) -> &[OrganizationUserType] { ... }
    fn exempt_providers(&self) -> bool { ... }
    fn enforced_statuses(&self) -> &[OrganizationUserStatusType] { ... }
}
Expand description

Strongly typed representation of a specific policy type in rust.

By implementing this, you define:

  • basic characteristics, such as the associated PolicyType and PolicyDataType, and the configuration data struct (if any)
  • enforcement behavior, such as role exemptions.

The defaults match the most common Bitwarden policy: Provider users, owners and administrators are exempt, and policies only apply to Accepted and Confirmed members.

Required Associated Types§

Source

type Data: Default + DeserializeOwned

The strongly-typed data for this policy. The Default value is the fall-back whenever the policy is not enforced or the raw data could not be parsed.

Required Methods§

Source

fn policy_type(&self) -> PolicyType

Returns the policy type this definition handles.

Source

fn to_erased(&self, data: Self::Data) -> PolicyDataType

Erases the strongly-typed Data into the FFI-friendly PolicyDataType.

Provided Methods§

Source

fn exempt_roles(&self) -> &[OrganizationUserType]

Returns the organization roles that are exempt from this policy.

Defaults to Owner and Admin.

Source

fn exempt_providers(&self) -> bool

Returns whether provider users are exempt from this policy.

Defaults to true.

Source

fn enforced_statuses(&self) -> &[OrganizationUserStatusType]

Returns the membership statuses that this policy should be enforced against.

Defaults to Accepted and Confirmed.

Implementors§

Source§

impl Policy for ActivateAutofillPolicy

Source§

impl Policy for AutomaticAppLogInPolicy

Source§

impl Policy for AutomaticUserConfirmationPolicy

Source§

impl Policy for AutotypeDefaultSettingPolicy

Source§

impl Policy for BlockClaimedDomainAccountCreationPolicy

Source§

impl Policy for DisablePersonalVaultExportPolicy

Source§

impl Policy for DisableSendPolicy

Source§

impl Policy for FillAssistPolicy

Source§

impl Policy for FreeFamiliesSponsorshipPolicy

Source§

impl Policy for MasterPasswordPolicy

Source§

impl Policy for MaximumVaultTimeoutPolicy

Source§

impl Policy for OrganizationDataOwnershipPolicy

Source§

impl Policy for OrganizationUserNotificationPolicy

Source§

impl Policy for PasswordGeneratorPolicy

Source§

impl Policy for RemoveUnlockWithPinPolicy

Source§

impl Policy for RequireSsoPolicy

Source§

impl Policy for ResetPasswordPolicy

Source§

impl Policy for RestrictedItemTypesPolicy

Source§

impl Policy for SendControlsPolicy

Source§

impl Policy for SendOptionsPolicy

Source§

impl Policy for SingleOrgPolicy

Source§

impl Policy for TwoFactorAuthenticationPolicy

Source§

impl Policy for UriMatchDefaultsPolicy