Skip to main content

bitwarden_uniffi/
policies.rs

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