Skip to main content

bitwarden_organizations/
types.rs

1use bitwarden_uuid::uuid_newtype;
2use serde::{Deserialize, Serialize};
3use serde_repr::{Deserialize_repr, Serialize_repr};
4
5uuid_newtype!(pub OrganizationUserId);
6uuid_newtype!(pub ProviderId);
7
8/// The membership status of a user within an organization.
9#[derive(PartialEq, Serialize_repr, Deserialize_repr, Debug, Clone)]
10#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
11#[bitwarden_ffi::wasm_object]
12#[repr(i8)]
13pub enum OrganizationUserStatusType {
14    /// The user's access has been revoked. This may occur at any time from any other status.
15    Revoked = -1,
16    /// The user has been invited but has not yet accepted.
17    Invited = 0,
18    /// The user has accepted the invitation but has not yet been confirmed by an admin.
19    Accepted = 1,
20    /// The user has been confirmed by an admin and has full access.
21    Confirmed = 2,
22    /// The user has been staged for provisioning but has not yet been invited.
23    Staged = 3,
24}
25
26/// The role of a user within an organization.
27#[derive(PartialEq, Serialize_repr, Deserialize_repr, Debug, Clone)]
28#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
29#[bitwarden_ffi::wasm_object]
30#[repr(u8)]
31pub enum OrganizationUserType {
32    /// Full administrative control over the organization.
33    Owner = 0,
34    /// Administrative access with most management capabilities.
35    Admin = 1,
36    /// Standard organization member.
37    User = 2,
38    // 3 was Manager, which has been permanently deleted
39    /// User with a customized set of permissions as indicated by [`Permissions`].
40    Custom = 4,
41}
42
43/// The type of provider.
44#[derive(PartialEq, Serialize_repr, Deserialize_repr, Debug, Clone)]
45#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
46#[bitwarden_ffi::wasm_object]
47#[repr(u8)]
48pub enum ProviderType {
49    /// Managed Service Provider - sells and manages its clients' Bitwarden organizations.
50    Msp = 0,
51    /// Reseller partner - sells Bitwarden to its clients but does not have any administrative
52    /// access.
53    Reseller = 1,
54    /// Business unit provider - used to manage multiple organizations which form part of a single
55    /// large enterprise.
56    BusinessUnit = 2,
57}
58
59/// The method used to decrypt organization member data.
60#[derive(PartialEq, Serialize_repr, Deserialize_repr, Debug, Clone)]
61#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
62#[bitwarden_ffi::wasm_object]
63#[repr(u8)]
64pub enum MemberDecryptionType {
65    /// Decryption using the user's master password.
66    MasterPassword = 0,
67    /// Decryption via Key Connector.
68    KeyConnector = 1,
69    /// Decryption via Trusted Device Encryption.
70    TrustedDeviceEncryption = 2,
71}
72
73/// The subscription tier of an organization.
74#[derive(PartialEq, Serialize_repr, Deserialize_repr, Debug, Clone)]
75#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
76#[bitwarden_ffi::wasm_object]
77#[repr(u8)]
78pub enum ProductTierType {
79    /// Free tier with limited features.
80    Free = 0,
81    /// Families plan for personal use.
82    Families = 1,
83    /// Teams plan for small organizations.
84    Teams = 2,
85    /// Enterprise plan with full features.
86    Enterprise = 3,
87    /// Starter tier for small teams.
88    TeamsStarter = 4,
89}
90
91/// Custom administrative permissions for an organization member with the
92/// [`OrganizationUserType::Custom`] role.
93#[derive(Default, PartialEq, Serialize, Deserialize, Debug, Clone)]
94#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
95#[bitwarden_ffi::wasm_record]
96#[serde(rename_all = "camelCase", default)]
97pub struct Permissions {
98    /// Can view the organization's event logs.
99    pub access_event_logs: bool,
100    /// Can import and export organization vault data.
101    pub access_import_export: bool,
102    /// Can access organization reports.
103    pub access_reports: bool,
104    /// Can create new collections.
105    pub create_new_collections: bool,
106    /// Can edit any collection, including those they are not assigned to.
107    pub edit_any_collection: bool,
108    /// Can delete any collection, including those they are not assigned to.
109    pub delete_any_collection: bool,
110    /// Can manage groups within the organization.
111    pub manage_groups: bool,
112    /// Can manage SSO configuration.
113    pub manage_sso: bool,
114    /// Can manage organization policies.
115    pub manage_policies: bool,
116    /// Can manage organization members.
117    pub manage_users: bool,
118    /// Can manage the account recovery (password reset) feature.
119    pub manage_reset_password: bool,
120    /// Can manage SCIM (System for Cross-domain Identity Management) configuration.
121    pub manage_scim: bool,
122}