Skip to main content

wekan_cli/commands/
admin.rs

1pub mod attachment_settings;
2mod input;
3pub mod settings;
4
5use crate::{
6    client::WekanClientFactory,
7    command_result::CommandSuccess,
8    credentials::{CredentialStore, SecretInputProvider},
9    error::AppError,
10};
11use clap::{Args, Subcommand};
12
13#[derive(Debug, Args)]
14pub struct AdminArgs {
15    #[command(subcommand)]
16    pub command: AdminCommand,
17}
18#[derive(Debug, Subcommand)]
19pub enum AdminCommand {
20    /// Read or update the global REST settings allowlist (site admin).
21    Settings(settings::SettingsArgs),
22    /// Configure attachment backends, restrictions, and migration settings (site admin).
23    AttachmentSettings(attachment_settings::AttachmentSettingsArgs),
24}
25pub(crate) async fn dispatch(
26    command: AdminCommand,
27    factory: &WekanClientFactory,
28    store: &dyn CredentialStore,
29    secrets: &dyn SecretInputProvider,
30) -> Result<CommandSuccess, AppError> {
31    match command {
32        AdminCommand::Settings(args) => settings::execute(args.command, factory, store).await,
33        AdminCommand::AttachmentSettings(args) => {
34            attachment_settings::execute(args.command, factory, store, secrets).await
35        }
36    }
37}