From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1CDC0618EF for ; Wed, 14 Oct 2020 08:57:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 120201406A for ; Wed, 14 Oct 2020 08:57:05 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 295D81405D for ; Wed, 14 Oct 2020 08:57:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DA70D45D1E for ; Wed, 14 Oct 2020 08:57:03 +0200 (CEST) Date: Wed, 14 Oct 2020 08:56:48 +0200 (CEST) From: Dietmar Maurer To: Proxmox Backup Server development discussion , Dylan Whyte Message-ID: <896602122.89.1602658608953@webmail.proxmox.com> In-Reply-To: <20201013085841.22773-2-d.whyte@proxmox.com> References: <20201013085841.22773-1-d.whyte@proxmox.com> <20201013085841.22773-2-d.whyte@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.4-Rev10 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.069 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-backup-client.rs, proxmox.com] Subject: Re: [pbs-devel] [PATCH proxmox-backup 2/2] fix #2847: proxmox-backup-client: add change-owner cmd X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2020 06:57:05 -0000 applied, adopted to previous api changes > On 10/13/2020 10:58 AM Dylan Whyte wrote: > > > This adds a change-owner command to proxmox-backup-client, > that allows a caller with datastore modify privileges > to change the owner of a backup-group. > > Signed-off-by: Dylan Whyte > --- > src/bin/proxmox-backup-client.rs | 43 +++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > > diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs > index 97398f49..90cb8378 100644 > --- a/src/bin/proxmox-backup-client.rs > +++ b/src/bin/proxmox-backup-client.rs > @@ -412,6 +412,41 @@ async fn list_backup_groups(param: Value) -> Result { > Ok(Value::Null) > } > > +#[api( > + input: { > + properties: { > + repository: { > + schema: REPO_URL_SCHEMA, > + optional: true, > + }, > + group: { > + type: String, > + description: "Backup group.", > + }, > + "new-owner": { > + type: String, type: Userid > + description: "Userid to transfer ownership to", > + }, > + } > + } > +)] > +/// Change owner of a backup group > +async fn change_backup_owner(mut param: Value) -> Result<(), Error> { > + > + let repo = extract_repository_from_value(¶m)?; > + > + let mut client = connect(repo.host(), repo.port(), repo.user())?; > + > + param.as_object_mut().unwrap().remove("repository"); > + > + let path = format!("api2/json/admin/datastore/{}/change-owner", repo.store()); > + client.post(&path, Some(param)).await?; > + > + record_repository(&repo); > + > + Ok(()) > +} > + > #[api( > input: { > properties: { > @@ -1967,6 +2002,11 @@ fn main() { > let version_cmd_def = CliCommand::new(&API_METHOD_API_VERSION) > .completion_cb("repository", complete_repository); > > + let change_owner_cmd_def = CliCommand::new(&API_METHOD_CHANGE_BACKUP_OWNER) > + .arg_param(&["group", "new-owner"]) > + .completion_cb("group", complete_backup_group) added: .completion_cb("new-owner", complete_user_name) > + .completion_cb("repository", complete_repository); > + > let cmd_def = CliCommandMap::new() > .insert("backup", backup_cmd_def) > .insert("upload-log", upload_log_cmd_def) > @@ -1987,7 +2027,8 @@ fn main() { > .insert("catalog", catalog_mgmt_cli()) > .insert("task", task_mgmt_cli()) > .insert("version", version_cmd_def) > - .insert("benchmark", benchmark_cmd_def); > + .insert("benchmark", benchmark_cmd_def) > + .insert("change-owner", change_owner_cmd_def); > > let rpcenv = CliEnvironment::new(); > run_cli_command(cmd_def, rpcenv, Some(|future| { > -- > 2.20.1 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel