Add role update command
This change adds the role update command to the CLI arguments and
configures the UpdateRoleAction to apply when the "role update"
subcommand is executed.
@@ -936,6 +936,58 @@ fn run<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(args: I) -> Result<
.value_name("ROLE ID")
.help("ID of role to be created"),
),
+ )
+ .subcommand(
+ SubCommand::with_name("update")
+ .about("Update a specific role on a Splinter node")
+ .arg(
+ Arg::with_name("url")
+ .short("U")
+ .long("url")
+ .help("URL of the Splinter daemon REST API")
+ .takes_value(true),
+ )
+ .arg(
+ Arg::with_name("private_key_file")
+ .value_name("private-key-file")
+ .short("k")
+ .long("key")
+ .takes_value(true)
+ .help("Name or path of private key"),
+ )
+ .arg(
+ Arg::with_name("display_name")
+ .value_name("display-name")
+ .short("D")
+ .long("display")
+ .takes_value(true)
+ .help("Display name of the role"),
+ )
+ .arg(
+ Arg::with_name("add_permission")
+ .value_name("permission")
+ .long("add-perm")
+ .takes_value(true)
+ .multiple(true)
+ .number_of_values(1)
+ .help("A permission to be added to the role"),
+ )
+ .arg(
+ Arg::with_name("rm_permission")
+ .value_name("permission")
+ .long("rm-perm")
+ .takes_value(true)
+ .multiple(true)
+ .number_of_values(1)
+ .help("A permission to be removed from the role"),
+ )
+ .arg(
+ Arg::with_name("role_id")
+ .required(true)
+ .takes_value(true)
+ .value_name("ROLE ID")
+ .help("ID of role to be updated"),
+ ),
),
);
}
@@ -1075,6 +1127,7 @@ fn run<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(args: I) -> Result<
"role",
SubcommandActions::new()
.with_command("create", rbac::CreateRoleAction)
+ .with_command("update", rbac::UpdateRoleAction)
.with_command("list", rbac::ListRolesAction)
.with_command("show", rbac::ShowRoleAction),
)
