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
PolicyTypeandPolicyDataType, 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§
Sourcetype Data: Default + DeserializeOwned
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§
Sourcefn policy_type(&self) -> PolicyType
fn policy_type(&self) -> PolicyType
Returns the policy type this definition handles.
Sourcefn to_erased(&self, data: Self::Data) -> PolicyDataType
fn to_erased(&self, data: Self::Data) -> PolicyDataType
Erases the strongly-typed Data into the FFI-friendly
PolicyDataType.
Provided Methods§
Sourcefn exempt_roles(&self) -> &[OrganizationUserType]
fn exempt_roles(&self) -> &[OrganizationUserType]
Sourcefn exempt_providers(&self) -> bool
fn exempt_providers(&self) -> bool
Returns whether provider users are exempt from this policy.
Defaults to true.