mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 20:32:48 +00:00
cli: Change principal displayname
This commit is contained in:
@@ -45,6 +45,8 @@ struct EditArgs {
|
||||
help = "Remove password (If you only want to use OIDC for example)"
|
||||
)]
|
||||
remove_password: bool,
|
||||
#[arg(short, long, help = "Change principal displayname")]
|
||||
name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
@@ -119,6 +121,7 @@ pub async fn cmd_principals(args: PrincipalsArgs) -> anyhow::Result<()> {
|
||||
id,
|
||||
remove_password,
|
||||
password,
|
||||
name,
|
||||
}) => {
|
||||
let mut principal = user_store
|
||||
.get_principal(&id)
|
||||
@@ -140,6 +143,9 @@ pub async fn cmd_principals(args: PrincipalsArgs) -> anyhow::Result<()> {
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
if name.is_some() {
|
||||
principal.displayname = name;
|
||||
}
|
||||
user_store.insert_principal(principal, true).await?;
|
||||
println!("Principal {id} updated");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user