cli: Change principal displayname

This commit is contained in:
Lennart
2025-04-26 10:58:52 +02:00
parent 4071ea4ff4
commit 6422ae8f57

View File

@@ -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");
} }