public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup 10/18] manager: add commands for managing LDAP realms
Date: Fri, 10 Feb 2023 11:16:20 +0100	[thread overview]
Message-ID: <1676023936.ktlvuvehan.astroid@yuna.none> (raw)
In-Reply-To: <20230209133128.695211-11-l.wagner@proxmox.com>

On February 9, 2023 2:31 pm, Lukas Wagner wrote:
> Adds commands for managing LDAP realms, including user sync, to
> `proxmox-backup-manager`.
> 
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
> ---
>  pbs-config/src/domains.rs              |  12 +-
>  src/bin/proxmox-backup-manager.rs      |   1 +
>  src/bin/proxmox_backup_manager/ldap.rs | 152 +++++++++++++++++++++++++
>  src/bin/proxmox_backup_manager/mod.rs  |   2 +
>  4 files changed, 165 insertions(+), 2 deletions(-)
>  create mode 100644 src/bin/proxmox_backup_manager/ldap.rs
> 
> [..]

> diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs
> index 86adabe3..740fdc49 100644
> --- a/src/bin/proxmox-backup-manager.rs
> +++ b/src/bin/proxmox-backup-manager.rs
> @@ -427,6 +427,7 @@ async fn run() -> Result<(), Error> {
>          .insert("datastore", datastore_commands())
>          .insert("disk", disk_commands())
>          .insert("dns", dns_commands())
> +        .insert("ldap", ldap_commands())
>          .insert("network", network_commands())
>          .insert("node", node_commands())
>          .insert("user", user_commands())
> diff --git a/src/bin/proxmox_backup_manager/ldap.rs b/src/bin/proxmox_backup_manager/ldap.rs
> new file mode 100644
> index 00000000..538c313b
> --- /dev/null
> +++ b/src/bin/proxmox_backup_manager/ldap.rs
> @@ -0,0 +1,152 @@
> +use anyhow::Error;
> +use serde_json::Value;
> +
> +use proxmox_router::{cli::*, ApiHandler, Permission, RpcEnvironment};
> +use proxmox_schema::api;
> +
> +use pbs_api_types::{
> +    Realm, PRIV_PERMISSIONS_MODIFY, PROXMOX_UPID_REGEX, REALM_ID_SCHEMA, REMOVE_VANISHED_SCHEMA,
> +};
> +
> +use proxmox_backup::api2;
> +

> [..]

> +
> +#[api(
> +    protected: true,
> +    input: {
> +        properties: {
> +            realm: {
> +                type: Realm,
> +            },
> +            "dry-run": {
> +                type: bool,
> +                description: "If set, do not create/delete anything",
> +                default: false,
> +                optional: true,
> +            },
> +            "remove-vanished": {
> +                optional: true,
> +                schema: REMOVE_VANISHED_SCHEMA,
> +            },
> +            "enable-new": {
> +                description: "Enable newly synced users immediately",
> +                optional: true,
> +                type: bool,
> +            }
> +         },
> +    },
> +    access: {
> +        permission: &Permission::Privilege(&["access", "users"], PRIV_PERMISSIONS_MODIFY, false),
> +    },
> +)]
> +/// Sync a given LDAP realm
> +async fn sync_ldap_realm(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
> +    let info = &api2::access::domain::API_METHOD_SYNC_REALM;
> +    let data = match info.handler {
> +        ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
> +        _ => unreachable!(),
> +    };
> +
> +    if let Some(upid) = data.as_str() {
> +        if PROXMOX_UPID_REGEX.is_match(upid) {
> +            proxmox_rest_server::handle_worker(upid).await?;
> +        }
> +    }

possibly late to the party given that the "handle_worker" move got applied already..

is there a good reason for introducing this instead of calling the endpoint over
the API and using the "I just spawned a task and want to poll the output" helper
(pbs_client::view_task_result), like the rest of proxmox-backup-manager does?

> +
> +    Ok(Value::Null)
> +}
> +




  reply	other threads:[~2023-02-10 10:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 13:31 [pbs-devel] [PATCH v3 proxmox{, -backup, -widget-toolkit} 00/18] add LDAP realm support Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox 01/18] rest-server: add handle_worker from backup debug cli Lukas Wagner
2023-02-10  9:44   ` [pbs-devel] applied: " Wolfgang Bumiller
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 02/18] debug cli: use handle_worker in proxmox-rest-server Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 03/18] pbs-config: add delete_authid to ACL-tree Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 04/18] ui: add 'realm' field in user edit Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 05/18] api-types: add LDAP configuration type Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 06/18] api: add routes for managing LDAP realms Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 07/18] auth: add LDAP realm authenticator Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 08/18] api-types: add config options for LDAP user sync Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 09/18] server: add LDAP realm sync job Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 10/18] manager: add commands for managing LDAP realms Lukas Wagner
2023-02-10 10:16   ` Fabian Grünbichler [this message]
2023-02-10 10:30     ` Lukas Wagner
2023-02-10 12:42       ` Wolfgang Bumiller
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 11/18] docs: add configuration file reference for domains.cfg Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 12/18] docs: add documentation for LDAP realms Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 13/18] auth: add dummy OpenIdAuthenticator struct Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-backup 14/18] auth: unify naming for all authenticator implementations Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-widget-toolkit 15/18] auth ui: add LDAP realm edit panel Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-widget-toolkit 16/18] auth ui: add LDAP sync UI Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-widget-toolkit 17/18] auth ui: add `onlineHelp` for AuthEditLDAP Lukas Wagner
2023-02-09 13:31 ` [pbs-devel] [PATCH v3 proxmox-widget-toolkit 18/18] auth ui: add `firstname` and `lastname` sync-attribute fields Lukas Wagner
2023-02-10 12:39 ` [pbs-devel] partially-applied: [PATCH v3 proxmox{, -backup, -widget-toolkit} 00/18] add LDAP realm support Wolfgang Bumiller
2023-02-10 14:01 ` [pbs-devel] " Friedrich Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1676023936.ktlvuvehan.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal