bitwarden_policies/
policies.rs1use bitwarden_organizations::OrganizationUserType;
9
10use crate::{MasterPasswordPolicyResponse, Policy, PolicyType, policy_type::PolicyDataType};
11
12pub struct TwoFactorAuthenticationPolicy;
14
15impl Policy for TwoFactorAuthenticationPolicy {
16 type Data = ();
17
18 fn policy_type(&self) -> PolicyType {
19 PolicyType::TwoFactorAuthentication
20 }
21
22 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
23 PolicyDataType::TwoFactorAuthentication
24 }
25}
26
27pub struct MasterPasswordPolicy;
29
30impl Policy for MasterPasswordPolicy {
31 type Data = MasterPasswordPolicyResponse;
32
33 fn policy_type(&self) -> PolicyType {
34 PolicyType::MasterPassword
35 }
36
37 fn to_erased(&self, data: Self::Data) -> PolicyDataType {
38 PolicyDataType::MasterPassword(data)
39 }
40
41 fn exempt_roles(&self) -> &[OrganizationUserType] {
42 &[]
43 }
44}
45
46pub struct PasswordGeneratorPolicy;
48
49impl Policy for PasswordGeneratorPolicy {
50 type Data = ();
51
52 fn policy_type(&self) -> PolicyType {
53 PolicyType::PasswordGenerator
54 }
55
56 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
57 PolicyDataType::PasswordGenerator
58 }
59
60 fn exempt_roles(&self) -> &[OrganizationUserType] {
61 &[]
62 }
63}
64
65pub struct SingleOrgPolicy;
67
68impl Policy for SingleOrgPolicy {
69 type Data = ();
70
71 fn policy_type(&self) -> PolicyType {
72 PolicyType::SingleOrg
73 }
74
75 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
76 PolicyDataType::SingleOrg
77 }
78}
79
80pub struct RequireSsoPolicy;
82
83impl Policy for RequireSsoPolicy {
84 type Data = ();
85
86 fn policy_type(&self) -> PolicyType {
87 PolicyType::RequireSso
88 }
89
90 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
91 PolicyDataType::RequireSso
92 }
93}
94
95pub struct OrganizationDataOwnershipPolicy;
97
98impl Policy for OrganizationDataOwnershipPolicy {
99 type Data = ();
100
101 fn policy_type(&self) -> PolicyType {
102 PolicyType::OrganizationDataOwnership
103 }
104
105 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
106 PolicyDataType::OrganizationDataOwnership
107 }
108}
109
110pub struct DisableSendPolicy;
112
113impl Policy for DisableSendPolicy {
114 type Data = ();
115
116 fn policy_type(&self) -> PolicyType {
117 PolicyType::DisableSend
118 }
119
120 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
121 PolicyDataType::DisableSend
122 }
123}
124
125pub struct SendOptionsPolicy;
127
128impl Policy for SendOptionsPolicy {
129 type Data = ();
130
131 fn policy_type(&self) -> PolicyType {
132 PolicyType::SendOptions
133 }
134
135 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
136 PolicyDataType::SendOptions
137 }
138}
139
140pub struct ResetPasswordPolicy;
142
143impl Policy for ResetPasswordPolicy {
144 type Data = ();
145
146 fn policy_type(&self) -> PolicyType {
147 PolicyType::ResetPassword
148 }
149
150 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
151 PolicyDataType::ResetPassword
152 }
153}
154
155pub struct MaximumVaultTimeoutPolicy;
157
158impl Policy for MaximumVaultTimeoutPolicy {
159 type Data = ();
160
161 fn policy_type(&self) -> PolicyType {
162 PolicyType::MaximumVaultTimeout
163 }
164
165 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
166 PolicyDataType::MaximumVaultTimeout
167 }
168
169 fn exempt_roles(&self) -> &[OrganizationUserType] {
170 &[OrganizationUserType::Owner]
171 }
172}
173
174pub struct DisablePersonalVaultExportPolicy;
176
177impl Policy for DisablePersonalVaultExportPolicy {
178 type Data = ();
179
180 fn policy_type(&self) -> PolicyType {
181 PolicyType::DisablePersonalVaultExport
182 }
183
184 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
185 PolicyDataType::DisablePersonalVaultExport
186 }
187}
188
189pub struct ActivateAutofillPolicy;
191
192impl Policy for ActivateAutofillPolicy {
193 type Data = ();
194
195 fn policy_type(&self) -> PolicyType {
196 PolicyType::ActivateAutofill
197 }
198
199 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
200 PolicyDataType::ActivateAutofill
201 }
202}
203
204pub struct AutomaticAppLogInPolicy;
206
207impl Policy for AutomaticAppLogInPolicy {
208 type Data = ();
209
210 fn policy_type(&self) -> PolicyType {
211 PolicyType::AutomaticAppLogIn
212 }
213
214 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
215 PolicyDataType::AutomaticAppLogIn
216 }
217}
218
219pub struct FreeFamiliesSponsorshipPolicy;
221
222impl Policy for FreeFamiliesSponsorshipPolicy {
223 type Data = ();
224
225 fn policy_type(&self) -> PolicyType {
226 PolicyType::FreeFamiliesSponsorship
227 }
228
229 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
230 PolicyDataType::FreeFamiliesSponsorship
231 }
232
233 fn exempt_roles(&self) -> &[OrganizationUserType] {
234 &[]
235 }
236}
237
238pub struct RemoveUnlockWithPinPolicy;
240
241impl Policy for RemoveUnlockWithPinPolicy {
242 type Data = ();
243
244 fn policy_type(&self) -> PolicyType {
245 PolicyType::RemoveUnlockWithPin
246 }
247
248 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
249 PolicyDataType::RemoveUnlockWithPin
250 }
251
252 fn exempt_roles(&self) -> &[OrganizationUserType] {
253 &[]
254 }
255}
256
257pub struct RestrictedItemTypesPolicy;
259
260impl Policy for RestrictedItemTypesPolicy {
261 type Data = ();
262
263 fn policy_type(&self) -> PolicyType {
264 PolicyType::RestrictedItemTypes
265 }
266
267 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
268 PolicyDataType::RestrictedItemTypes
269 }
270
271 fn exempt_roles(&self) -> &[OrganizationUserType] {
272 &[]
273 }
274}
275
276pub struct UriMatchDefaultsPolicy;
278
279impl Policy for UriMatchDefaultsPolicy {
280 type Data = ();
281
282 fn policy_type(&self) -> PolicyType {
283 PolicyType::UriMatchDefaults
284 }
285
286 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
287 PolicyDataType::UriMatchDefaults
288 }
289}
290
291pub struct AutotypeDefaultSettingPolicy;
293
294impl Policy for AutotypeDefaultSettingPolicy {
295 type Data = ();
296
297 fn policy_type(&self) -> PolicyType {
298 PolicyType::AutotypeDefaultSetting
299 }
300
301 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
302 PolicyDataType::AutotypeDefaultSetting
303 }
304}
305
306pub struct AutomaticUserConfirmationPolicy;
308
309impl Policy for AutomaticUserConfirmationPolicy {
310 type Data = ();
311
312 fn policy_type(&self) -> PolicyType {
313 PolicyType::AutomaticUserConfirmation
314 }
315
316 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
317 PolicyDataType::AutomaticUserConfirmation
318 }
319
320 fn exempt_roles(&self) -> &[OrganizationUserType] {
321 &[]
322 }
323}
324
325pub struct BlockClaimedDomainAccountCreationPolicy;
327
328impl Policy for BlockClaimedDomainAccountCreationPolicy {
329 type Data = ();
330
331 fn policy_type(&self) -> PolicyType {
332 PolicyType::BlockClaimedDomainAccountCreation
333 }
334
335 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
336 PolicyDataType::BlockClaimedDomainAccountCreation
337 }
338}
339
340pub struct OrganizationUserNotificationPolicy;
342
343impl Policy for OrganizationUserNotificationPolicy {
344 type Data = ();
345
346 fn policy_type(&self) -> PolicyType {
347 PolicyType::OrganizationUserNotification
348 }
349
350 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
351 PolicyDataType::OrganizationUserNotification
352 }
353
354 fn exempt_roles(&self) -> &[OrganizationUserType] {
355 &[]
356 }
357}
358
359pub struct SendControlsPolicy;
361
362impl Policy for SendControlsPolicy {
363 type Data = ();
364
365 fn policy_type(&self) -> PolicyType {
366 PolicyType::SendControls
367 }
368
369 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
370 PolicyDataType::SendControls
371 }
372}
373
374pub struct FillAssistPolicy;
376
377impl Policy for FillAssistPolicy {
378 type Data = ();
379
380 fn policy_type(&self) -> PolicyType {
381 PolicyType::FillAssist
382 }
383
384 fn exempt_roles(&self) -> &[OrganizationUserType] {
385 &[]
386 }
387
388 fn to_erased(&self, _data: Self::Data) -> PolicyDataType {
389 PolicyDataType::FillAssist
390 }
391}