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