1use crate::client::admin::{
2 BatchSize, CpuThreshold, DelayMs, NonNegativeNumber, SettingNumber,
3 attachment_settings as storage, settings as global,
4};
5use serde::Serialize;
6
7mod login_providers;
8mod problems;
9pub use login_providers::{
10 BooleanConfigValue, ConfigSource, OauthProviderSettings, OauthProviderSource,
11 OauthProviderSources, PasswordlessSettings, SecretConfigSource,
12};
13pub use problems::{
14 DetectedProblem, EventActor, EventLocation, NewProblemCount, ProblemAcknowledgment,
15 ProblemEvent, ProblemPage, ProblemsOverview, ProgressProblem,
16};
17
18use crate::client::admin::people::{
19 DomainCount, FeatureField, OrganizationDocument, OrganizationSummary, TeamDocument, TeamSummary,
20};
21
22#[derive(Debug, Eq, PartialEq, Serialize)]
23pub struct AdminDomainCollectionSuccess {
24 pub domains: Vec<DomainCount>,
25}
26#[derive(Debug, Eq, PartialEq, Serialize)]
27pub struct AdminOrganizationCollectionSuccess {
28 pub organizations: Vec<OrganizationSummary>,
29}
30#[derive(Debug, Eq, PartialEq, Serialize)]
31pub struct AdminTeamCollectionSuccess {
32 pub teams: Vec<TeamSummary>,
33}
34#[derive(Debug, Eq, PartialEq, Serialize)]
35pub struct AdminOrganizationUpdateSuccess {
36 pub organization: OrganizationDocument,
37 pub submitted_fields: Vec<FeatureField>,
38}
39#[derive(Debug, Eq, PartialEq, Serialize)]
40pub struct AdminTeamUpdateSuccess {
41 pub team: TeamDocument,
42 pub submitted_fields: Vec<FeatureField>,
43}
44#[derive(Debug, Eq, PartialEq, Serialize)]
45pub struct AdminFeaturesUpdateAllSuccess {
46 pub field: FeatureField,
47 pub value: bool,
48 pub updated: u64,
49}
50
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
52#[serde(rename_all = "snake_case")]
53pub enum GlobalSettingField {
54 DisableRegistration,
55 DisableForgotPassword,
56 ProductName,
57 DisplayAuthenticationMethod,
58 DefaultAuthenticationMethod,
59 SpinnerName,
60 HideLogo,
61 HideCardCounterList,
62 HideBoardMemberList,
63 CustomLoginLogoImageUrl,
64 CustomLoginLogoLinkUrl,
65 CustomHelpLinkUrl,
66 TextBelowCustomLoginLogo,
67 AutomaticLinkedUrlSchemes,
68 CustomTopLeftCornerLogoImageUrl,
69 CustomTopLeftCornerLogoLinkUrl,
70 CustomTopLeftCornerLogoHeight,
71 OidcBtnText,
72 MailDomainName,
73 LegalNotice,
74 CustomHeadEnabled,
75 CustomHeadMetaTags,
76 CustomHeadLinkTags,
77 CustomManifestEnabled,
78 CustomManifestContent,
79 CustomAssetLinksEnabled,
80 CustomAssetLinksContent,
81 AccessibilityPageEnabled,
82 AccessibilityTitle,
83 AccessibilityContent,
84 SupportPopupText,
85 SupportPageEnabled,
86 SupportPagePublic,
87 SupportTitle,
88 SupportPageText,
89}
90
91#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
92#[serde(rename_all = "snake_case")]
93pub enum AttachmentSettingField {
94 DefaultStorage,
95 StorageConfig,
96 UploadSettings,
97 LimitSettings,
98 MigrationSettings,
99}
100#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
101pub struct GlobalSettingsDetail {
102 pub settings_id: Option<String>,
103 pub disable_registration: Option<bool>,
104 pub disable_forgot_password: Option<bool>,
105 pub product_name: Option<String>,
106 pub display_authentication_method: Option<bool>,
107 pub default_authentication_method: Option<String>,
108 pub spinner_name: Option<String>,
109 pub hide_logo: Option<bool>,
110 pub hide_card_counter_list: Option<bool>,
111 pub hide_board_member_list: Option<bool>,
112 pub custom_login_logo_image_url: Option<String>,
113 pub custom_login_logo_link_url: Option<String>,
114 pub custom_help_link_url: Option<String>,
115 pub text_below_custom_login_logo: Option<String>,
116 pub automatic_linked_url_schemes: Option<String>,
117 pub custom_top_left_corner_logo_image_url: Option<String>,
118 pub custom_top_left_corner_logo_link_url: Option<String>,
119 pub custom_top_left_corner_logo_height: Option<String>,
120 pub oidc_btn_text: Option<String>,
121 pub mail_domain_name: Option<String>,
122 pub legal_notice: Option<String>,
123 pub custom_head_enabled: Option<bool>,
124 pub custom_head_meta_tags: Option<String>,
125 pub custom_head_link_tags: Option<String>,
126 pub custom_manifest_enabled: Option<bool>,
127 pub custom_manifest_content: Option<String>,
128 pub custom_asset_links_enabled: Option<bool>,
129 pub custom_asset_links_content: Option<String>,
130 pub accessibility_page_enabled: Option<bool>,
131 pub accessibility_title: Option<String>,
132 pub accessibility_content: Option<String>,
133 pub support_popup_text: Option<String>,
134 pub support_page_enabled: Option<bool>,
135 pub support_page_public: Option<bool>,
136 pub support_title: Option<String>,
137 pub support_page_text: Option<String>,
138}
139impl From<global::GlobalSettingsDocument> for GlobalSettingsDetail {
140 fn from(d: global::GlobalSettingsDocument) -> Self {
141 Self {
142 settings_id: d.settings_id,
143 disable_registration: d.disable_registration,
144 disable_forgot_password: d.disable_forgot_password,
145 product_name: d.product_name,
146 display_authentication_method: d.display_authentication_method,
147 default_authentication_method: d.default_authentication_method,
148 spinner_name: d.spinner_name,
149 hide_logo: d.hide_logo,
150 hide_card_counter_list: d.hide_card_counter_list,
151 hide_board_member_list: d.hide_board_member_list,
152 custom_login_logo_image_url: d.custom_login_logo_image_url,
153 custom_login_logo_link_url: d.custom_login_logo_link_url,
154 custom_help_link_url: d.custom_help_link_url,
155 text_below_custom_login_logo: d.text_below_custom_login_logo,
156 automatic_linked_url_schemes: d.automatic_linked_url_schemes,
157 custom_top_left_corner_logo_image_url: d.custom_top_left_corner_logo_image_url,
158 custom_top_left_corner_logo_link_url: d.custom_top_left_corner_logo_link_url,
159 custom_top_left_corner_logo_height: d.custom_top_left_corner_logo_height,
160 oidc_btn_text: d.oidc_btn_text,
161 mail_domain_name: d.mail_domain_name,
162 legal_notice: d.legal_notice,
163 custom_head_enabled: d.custom_head_enabled,
164 custom_head_meta_tags: d.custom_head_meta_tags,
165 custom_head_link_tags: d.custom_head_link_tags,
166 custom_manifest_enabled: d.custom_manifest_enabled,
167 custom_manifest_content: d.custom_manifest_content,
168 custom_asset_links_enabled: d.custom_asset_links_enabled,
169 custom_asset_links_content: d.custom_asset_links_content,
170 accessibility_page_enabled: d.accessibility_page_enabled,
171 accessibility_title: d.accessibility_title,
172 accessibility_content: d.accessibility_content,
173 support_popup_text: d.support_popup_text,
174 support_page_enabled: d.support_page_enabled,
175 support_page_public: d.support_page_public,
176 support_title: d.support_title,
177 support_page_text: d.support_page_text,
178 }
179 }
180}
181#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
182pub struct FilesystemSettingsDetail {
183 pub enabled: bool,
184 pub read: bool,
185 pub write: bool,
186 pub path: Option<String>,
187}
188impl From<storage::FilesystemDocument> for FilesystemSettingsDetail {
189 fn from(d: storage::FilesystemDocument) -> Self {
190 Self {
191 enabled: d.enabled,
192 read: d.read,
193 write: d.write,
194 path: d.path,
195 }
196 }
197}
198#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
199pub struct GridfsSettingsDetail {
200 pub enabled: bool,
201 pub read: bool,
202 pub write: bool,
203}
204impl From<storage::GridfsDocument> for GridfsSettingsDetail {
205 fn from(d: storage::GridfsDocument) -> Self {
206 Self {
207 enabled: d.enabled,
208 read: d.read,
209 write: d.write,
210 }
211 }
212}
213#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
214pub struct S3SettingsDetail {
215 pub enabled: Option<bool>,
216 pub read: Option<bool>,
217 pub write: Option<bool>,
218 pub endpoint: Option<String>,
219 pub region: Option<String>,
220 pub bucket: Option<String>,
221 pub access_key_id: Option<String>,
222 pub force_path_style: Option<bool>,
223 pub secret_access_key_set: bool,
224}
225impl From<storage::S3Document> for S3SettingsDetail {
226 fn from(d: storage::S3Document) -> Self {
227 Self {
228 enabled: d.enabled,
229 read: d.read,
230 write: d.write,
231 endpoint: d.endpoint,
232 region: d.region,
233 bucket: d.bucket,
234 access_key_id: d.access_key_id,
235 force_path_style: d.force_path_style,
236 secret_access_key_set: d.secret_access_key_set,
237 }
238 }
239}
240#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
241pub struct AzureSettingsDetail {
242 pub enabled: Option<bool>,
243 pub read: Option<bool>,
244 pub write: Option<bool>,
245 pub account_name: Option<String>,
246 pub bucket: Option<String>,
247 pub account_key_set: bool,
248 pub connection_string_set: bool,
249}
250impl From<storage::AzureDocument> for AzureSettingsDetail {
251 fn from(d: storage::AzureDocument) -> Self {
252 Self {
253 enabled: d.enabled,
254 read: d.read,
255 write: d.write,
256 account_name: d.account_name,
257 bucket: d.bucket,
258 account_key_set: d.account_key_set,
259 connection_string_set: d.connection_string_set,
260 }
261 }
262}
263#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
264pub struct GcsSettingsDetail {
265 pub enabled: Option<bool>,
266 pub read: Option<bool>,
267 pub write: Option<bool>,
268 pub project_id: Option<String>,
269 pub key_filename: Option<String>,
270 pub bucket: Option<String>,
271 pub credentials_set: bool,
272}
273impl From<storage::GcsDocument> for GcsSettingsDetail {
274 fn from(d: storage::GcsDocument) -> Self {
275 Self {
276 enabled: d.enabled,
277 read: d.read,
278 write: d.write,
279 project_id: d.project_id,
280 key_filename: d.key_filename,
281 bucket: d.bucket,
282 credentials_set: d.credentials_set,
283 }
284 }
285}
286#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
287pub struct UploadSettingsDetail {
288 pub max_file_size: Option<SettingNumber>,
289 pub allowed_mime_types: Option<Vec<String>>,
290}
291impl From<storage::UploadDocument> for UploadSettingsDetail {
292 fn from(d: storage::UploadDocument) -> Self {
293 Self {
294 max_file_size: d.max_file_size,
295 allowed_mime_types: d.allowed_mime_types,
296 }
297 }
298}
299#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
300pub struct LimitsSettingsDetail {
301 pub attachments_upload_max_bytes: Option<NonNegativeNumber>,
302 pub attachments_upload_blocked: Option<bool>,
303 pub avatars_upload_blocked: Option<bool>,
304 pub attachments_download_max_bytes: Option<NonNegativeNumber>,
305 pub attachments_download_blocked: Option<bool>,
306 pub api_upload_max_bytes: Option<NonNegativeNumber>,
307 pub api_upload_blocked: Option<bool>,
308 pub api_download_max_bytes: Option<NonNegativeNumber>,
309 pub api_download_blocked: Option<bool>,
310}
311impl From<storage::LimitsDocument> for LimitsSettingsDetail {
312 fn from(d: storage::LimitsDocument) -> Self {
313 Self {
314 attachments_upload_max_bytes: d.attachments_upload_max_bytes,
315 attachments_upload_blocked: d.attachments_upload_blocked,
316 avatars_upload_blocked: d.avatars_upload_blocked,
317 attachments_download_max_bytes: d.attachments_download_max_bytes,
318 attachments_download_blocked: d.attachments_download_blocked,
319 api_upload_max_bytes: d.api_upload_max_bytes,
320 api_upload_blocked: d.api_upload_blocked,
321 api_download_max_bytes: d.api_download_max_bytes,
322 api_download_blocked: d.api_download_blocked,
323 }
324 }
325}
326#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
327pub struct MigrationSettingsDetail {
328 pub auto_migrate: bool,
329 pub batch_size: BatchSize,
330 pub delay_ms: DelayMs,
331 pub cpu_threshold: CpuThreshold,
332}
333impl From<storage::MigrationDocument> for MigrationSettingsDetail {
334 fn from(d: storage::MigrationDocument) -> Self {
335 Self {
336 auto_migrate: d.auto_migrate,
337 batch_size: d.batch_size,
338 delay_ms: d.delay_ms,
339 cpu_threshold: d.cpu_threshold,
340 }
341 }
342}
343#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
344pub struct WebdavSettingsDetail {
345 pub enabled: Option<bool>,
346 pub read: Option<bool>,
347 pub write: Option<bool>,
348 pub endpoint: Option<String>,
349 pub username: Option<String>,
350 pub bucket: Option<String>,
351 pub password_set: bool,
352}
353impl From<storage::WebdavDocument> for WebdavSettingsDetail {
354 fn from(d: storage::WebdavDocument) -> Self {
355 Self {
356 enabled: d.enabled,
357 read: d.read,
358 write: d.write,
359 endpoint: d.endpoint,
360 username: d.username,
361 bucket: d.bucket,
362 password_set: d.password_set,
363 }
364 }
365}
366#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
367pub struct StorageConfigDetail {
368 pub webdav: Option<WebdavSettingsDetail>,
369 pub filesystem: Option<FilesystemSettingsDetail>,
370 pub gridfs: Option<GridfsSettingsDetail>,
371 pub s3: Option<S3SettingsDetail>,
372 pub azure: Option<AzureSettingsDetail>,
373 pub gcs: Option<GcsSettingsDetail>,
374}
375impl From<storage::StorageConfigDocument> for StorageConfigDetail {
376 fn from(d: storage::StorageConfigDocument) -> Self {
377 Self {
378 webdav: d.webdav.map(Into::into),
379 filesystem: d.filesystem.map(Into::into),
380 gridfs: d.gridfs.map(Into::into),
381 s3: d.s3.map(Into::into),
382 azure: d.azure.map(Into::into),
383 gcs: d.gcs.map(Into::into),
384 }
385 }
386}
387#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
388pub struct AttachmentSettingsDetail {
389 pub default_storage: storage::StorageBackend,
390 pub storage_config: Option<StorageConfigDetail>,
391 pub upload_settings: Option<UploadSettingsDetail>,
392 pub limit_settings: Option<LimitsSettingsDetail>,
393 pub migration_settings: Option<MigrationSettingsDetail>,
394 pub created_at: String,
395 pub updated_at: String,
396 pub created_by: Option<String>,
397 pub updated_by: Option<String>,
398 pub settings_id: String,
399}
400impl From<storage::AttachmentSettingsDocument> for AttachmentSettingsDetail {
401 fn from(d: storage::AttachmentSettingsDocument) -> Self {
402 Self {
403 default_storage: d.default_storage,
404 storage_config: d.storage_config.map(Into::into),
405 upload_settings: d.upload_settings.map(Into::into),
406 limit_settings: d.limit_settings.map(Into::into),
407 migration_settings: d.migration_settings.map(Into::into),
408 created_at: d.created_at,
409 updated_at: d.updated_at,
410 created_by: d.created_by,
411 updated_by: d.updated_by,
412 settings_id: d.settings_id,
413 }
414 }
415}
416#[derive(Debug, Eq, PartialEq, Serialize)]
417pub struct GlobalSettingsSuccess {
418 pub settings: GlobalSettingsDetail,
419}
420#[derive(Debug, Eq, PartialEq, Serialize)]
421pub struct GlobalSettingsUpdateSuccess {
422 pub settings: GlobalSettingsDetail,
423 pub submitted_fields: Vec<GlobalSettingField>,
424}
425#[derive(Debug, Eq, PartialEq, Serialize)]
426pub struct AttachmentSettingsSuccess {
427 pub settings: AttachmentSettingsDetail,
428}
429#[derive(Debug, Eq, PartialEq, Serialize)]
430pub struct AttachmentSettingsUpdateSuccess {
431 pub settings: AttachmentSettingsDetail,
432 pub submitted_fields: Vec<AttachmentSettingField>,
433}