Skip to main content

wekan_cli/command_result/
admin.rs

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