From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Dietmar Maurer <dietmar@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup v3 05/10] cli: add CLI to manage openid realms.
Date: Fri, 25 Jun 2021 13:41:13 +0200 [thread overview]
Message-ID: <20210625114113.lod2dtzqncranq5i@wobu-vie.proxmox.com> (raw)
In-Reply-To: <20210625092050.2329182-6-dietmar@proxmox.com>
just a minor cleanup:
On Fri, Jun 25, 2021 at 11:20:45AM +0200, Dietmar Maurer wrote:
> diff --git a/src/bin/proxmox_backup_manager/openid.rs b/src/bin/proxmox_backup_manager/openid.rs
> new file mode 100644
> index 00000000..13915339
> --- /dev/null
> +++ b/src/bin/proxmox_backup_manager/openid.rs
> @@ -0,0 +1,99 @@
> +use anyhow::Error;
> +use serde_json::Value;
> +
> +use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
> +
> +use proxmox_backup::{config, api2, api2::types::REALM_ID_SCHEMA};
> +
> +
> +#[api(
> + input: {
> + properties: {
> + "output-format": {
> + schema: OUTPUT_FORMAT,
> + optional: true,
> + },
> + }
> + }
> +)]
> +/// List configured OpenId realms
> +fn list_openid_realms(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
> +
> + let output_format = get_output_format(¶m);
> +
> + let info = &api2::config::access::openid::API_METHOD_LIST_OPENID_REALMS;
> + let mut data = match info.handler {
> + ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
> + _ => unreachable!(),
> + };
> +
> + let options = default_table_format_options()
> + .column(ColumnConfig::new("realm"))
> + .column(ColumnConfig::new("issuer-url"))
> + .column(ColumnConfig::new("comment"));
> +
> + format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
> +
> + Ok(Value::Null)
> +}
> +#[api(
> + input: {
> + properties: {
> + realm: {
> + schema: REALM_ID_SCHEMA,
> + },
> + "output-format": {
> + schema: OUTPUT_FORMAT,
> + optional: true,
> + },
> + }
> + }
> +)]
> +
> +/// Show OpenID realm configuration
> +fn show_openid_realm(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
> +
> + let output_format = get_output_format(¶m);
> +
> + let info = &api2::config::access::openid::API_METHOD_READ_OPENID_REALM;
> + let mut data = match info.handler {
> + ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
> + _ => unreachable!(),
> + };
> +
> + let options = default_table_format_options();
> + format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
> +
> + Ok(Value::Null)
> +}
> +
> +pub fn openid_commands() -> CommandLineInterface {
> +
> + let cmd_def = CliCommandMap::new()
> + .insert("list", CliCommand::new(&&API_METHOD_LIST_OPENID_REALMS))
> + .insert("show", CliCommand::new(&&API_METHOD_SHOW_OPENID_REALM)
> + .arg_param(&["realm"])
> + .completion_cb("realm", config::domains::complete_openid_realm_name)
> + )
> + .insert("create",
> + CliCommand::new(&api2::config::access::openid::API_METHOD_CREATE_OPENID_REALM)
> + .arg_param(&["realm"])
> + .arg_param(&["realm"])
^ this line is duplicated
> + .completion_cb("realm", config::domains::complete_openid_realm_name)
> + )
> + .insert("update",
> + CliCommand::new(&api2::config::access::openid::API_METHOD_UPDATE_OPENID_REALM)
> + .arg_param(&["realm"])
> + .arg_param(&["realm"])
^ this line is duplicated
> + .completion_cb("realm", config::domains::complete_openid_realm_name)
> + )
> + .insert("delete",
> + CliCommand::new(&api2::config::access::openid::API_METHOD_DELETE_OPENID_REALM)
> + .arg_param(&["realm"])
> + .arg_param(&["realm"])
^ this line is duplicated
> + .completion_cb("realm", config::domains::complete_openid_realm_name)
> + )
> + ;
> +
> + cmd_def.into()
> +}
next prev parent reply other threads:[~2021-06-25 11:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 9:20 [pbs-devel] [PATCH proxmox-backup v3 00/10] OpenID connect realms Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 01/10] depend on proxmox-openid-rs Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 02/10] config: new domains.cfg to configure openid realm Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 03/10] check_acl_path: add /access/domains and /access/openid Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 04/10] add API to manage openid realms Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 05/10] cli: add CLI " Dietmar Maurer
2021-06-25 11:41 ` Wolfgang Bumiller [this message]
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 06/10] implement new helper is_active_user_id() Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 07/10] cleanup user/token is_active() check Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 08/10] api: add openid redirect/login API Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 09/10] ui: implement OpenId login Dietmar Maurer
2021-06-25 9:20 ` [pbs-devel] [PATCH proxmox-backup v3 10/10] fix CachedUserInfo by using a shared memory version counter Dietmar Maurer
2021-06-29 9:50 ` [pbs-devel] [PATCH proxmox-backup v3 00/10] OpenID connect realms Fabian Grünbichler
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=20210625114113.lod2dtzqncranq5i@wobu-vie.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=dietmar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.