Skip to main content

bitwarden_uniffi/
policies.rs

1use bitwarden_policies::{OrganizationUserPolicyContext, PolicyClient, PolicyType, PolicyView};
2
3/// Client for policy domain operations.
4#[derive(uniffi::Object)]
5pub struct PoliciesClient(pub(crate) PolicyClient);
6
7#[uniffi::export]
8impl PoliciesClient {
9    /// Filter policies of the given type for the current user.
10    ///
11    /// Returns the subset of `policies` that should be enforced against the user,
12    /// based on their organization memberships and roles.
13    pub fn filter_by_type(
14        &self,
15        policies: Vec<PolicyView>,
16        organization_user_policy_contexts: Vec<OrganizationUserPolicyContext>,
17        policy_type: PolicyType,
18    ) -> Vec<PolicyView> {
19        self.0
20            .filter_by_type(policies, organization_user_policy_contexts, policy_type)
21    }
22}