mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
parent
87b20d22d1
commit
2ea8a0ed88
|
@ -20,6 +20,11 @@ impl KanidmClient {
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn group_rename(&self, name: &str, new_name: &str) -> Result<(), ClientError> {
|
||||
self.perform_put_request(&format!("/v1/group/{}/_attr/name", name), vec![new_name])
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn group_account_policy_authsession_expiry_set(
|
||||
&self,
|
||||
id: &str,
|
||||
|
|
|
@ -16,7 +16,7 @@ impl GroupOpt {
|
|||
GroupOpt::RemoveMembers(gcopt) => gcopt.copt.debug,
|
||||
GroupOpt::SetMembers(gcopt) => gcopt.copt.debug,
|
||||
GroupOpt::PurgeMembers(gcopt) => gcopt.copt.debug,
|
||||
GroupOpt::SetMail { copt, .. } => copt.debug,
|
||||
GroupOpt::Rename { copt, .. } | GroupOpt::SetMail { copt, .. } => copt.debug,
|
||||
GroupOpt::Posix { commands } => match commands {
|
||||
GroupPosix::Show(gcopt) => gcopt.copt.debug,
|
||||
GroupPosix::Set(gcopt) => gcopt.copt.debug,
|
||||
|
@ -178,6 +178,20 @@ impl GroupOpt {
|
|||
Ok(_) => println!("Successfully set mail for group {}", name.as_str()),
|
||||
}
|
||||
}
|
||||
GroupOpt::Rename {
|
||||
copt,
|
||||
name,
|
||||
new_name,
|
||||
} => {
|
||||
let client = copt.to_client(OpType::Write).await;
|
||||
|
||||
let result = client.group_rename(name.as_str(), new_name.as_str()).await;
|
||||
|
||||
match result {
|
||||
Err(e) => handle_client_error(e, copt.output_mode),
|
||||
Ok(_) => println!("Successfully renamed group {} to {}", name, new_name),
|
||||
}
|
||||
}
|
||||
GroupOpt::SetEntryManagedBy {
|
||||
name,
|
||||
entry_managed_by,
|
||||
|
|
|
@ -284,6 +284,16 @@ pub enum GroupOpt {
|
|||
#[clap(flatten)]
|
||||
copt: CommonOpt,
|
||||
},
|
||||
/// Rename an existing group
|
||||
#[clap(name = "rename")]
|
||||
Rename {
|
||||
/// The name of the group
|
||||
name: String,
|
||||
/// The new name of the group
|
||||
new_name: String,
|
||||
#[clap(flatten)]
|
||||
copt: CommonOpt,
|
||||
},
|
||||
/// Delete all members of a group.
|
||||
#[clap(name = "purge-members")]
|
||||
PurgeMembers(Named),
|
||||
|
|
Loading…
Reference in a new issue