This is an automated email from the ASF dual-hosted git repository.
hubcio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new a029d4db4 fix(cli): fix help text of user permissions -g and -s (#4484)
a029d4db4 is described below
commit a029d4db48e0ff401059208e51a5064dd8ce75fd
Author: GON <[email protected]>
AuthorDate: Sat Oct 10 12:44:55 2026 -0400
fix(cli): fix help text of user permissions -g and -s (#4484)
---
core/cli/src/args/user.rs | 20 +++++---
.../cli/user/test_user_permissions_command.rs | 59 ++++++++++------------
2 files changed, 40 insertions(+), 39 deletions(-)
diff --git a/core/cli/src/args/user.rs b/core/cli/src/args/user.rs
index 81a6f8f2a..d947ef54a 100644
--- a/core/cli/src/args/user.rs
+++ b/core/cli/src/args/user.rs
@@ -94,6 +94,10 @@ pub(crate) enum UserAction {
/// options are set, the default behavior is to remove permissions for the
/// specified user.
///
+ /// The command replaces the full permission set of the user. If only
+ /// --global-permissions is set, stream permissions are removed. If only
+ /// --stream-permissions is set, all global permissions are set to false.
+ ///
/// Examples:
/// iggy user permissions 2
/// iggy user permissions client
@@ -249,7 +253,7 @@ pub(crate) struct UserPermissionsArgs {
///
/// The user ID can be specified as either a username or an ID
pub(crate) user_id: Identifier,
- /// Set global permissions for created user
+ /// Set global permissions for the user
///
/// All global permissions by default are set to false and this command
line option
/// allows to set each permission individually. Permissions are separated
@@ -263,12 +267,12 @@ pub(crate) struct UserPermissionsArgs {
/// read_topics / r_top, poll_messages / p_msg, send_messages / s_msg
///
/// Examples:
- /// iggy user create guest guess --global-permissions p_msg,s_msg
- /// iggy user create admin pass#1%X! -g
m_srv,r_srv,m_usr,r_usr,m_str,r_str,m_top,r_top,p_msg,s_msg
+ /// iggy user permissions guest --global-permissions p_msg,s_msg
+ /// iggy user permissions admin -g
m_srv,r_srv,m_usr,r_usr,m_str,r_str,m_top,r_top,p_msg,s_msg
#[clap(short, long, verbatim_doc_comment)]
#[arg(value_parser = clap::value_parser!(GlobalPermissionsArg))]
pub(crate) global_permissions: Option<GlobalPermissionsArg>,
- /// Set stream permissions for created user
+ /// Set stream permissions for the user
///
/// Stream permissions are defined by each stream separately. Setting
permission for stream
/// allows to set each permission individually, by default, if no
permission is provided
@@ -294,10 +298,10 @@ pub(crate) struct UserPermissionsArgs {
/// Permissions format:
STREAM_ID\[:STREAM_PERMISSIONS\]\[#TOPIC_ID\[:TOPIC_PERMISSIONS\]\]
///
/// Examples:
- /// iggy user create guest guest -s 1:manage_topics,read_topics
- /// iggy user create admin p@Ss! --stream-permissions
2:m_str,r_str,m_top,r_top,p_msg,s_msg
- /// iggy user create sender s3n43r -s 3#1:s_msg#2:s_msg
- /// iggy user create user1 test12 -s
4:manage_stream,r_top#1:s_msg,p_msg#2:manage_topic
+ /// iggy user permissions guest -s 1:manage_topics,read_topics
+ /// iggy user permissions admin --stream-permissions
2:m_str,r_str,m_top,r_top,p_msg,s_msg
+ /// iggy user permissions sender -s 3#1:s_msg#2:s_msg
+ /// iggy user permissions user1 -s
4:manage_stream,r_top#1:s_msg,p_msg#2:manage_topic
#[clap(short, long, verbatim_doc_comment)]
#[arg(value_parser = clap::value_parser!(StreamPermissionsArg))]
pub(crate) stream_permissions: Option<Vec<StreamPermissionsArg>>,
diff --git a/core/integration/tests/cli/user/test_user_permissions_command.rs
b/core/integration/tests/cli/user/test_user_permissions_command.rs
index f44afb69e..a08de4c92 100644
--- a/core/integration/tests/cli/user/test_user_permissions_command.rs
+++ b/core/integration/tests/cli/user/test_user_permissions_command.rs
@@ -240,37 +240,34 @@ pub async fn should_help_match() {
iggy_cmd_test
.execute_test_for_help_command(TestHelpCmd::new(
- vec!["user", "create", "--help"],
+ vec!["user", "permissions", "--help"],
format!(
- r#"Create user with given username and password
+ r#"Set permissions for user with given ID
-Examples
- iggy user create testuser pass#1%X!
- iggy user create guest guess --user-status inactive
+The user ID can be specified as either a username or an ID. Permissions
+are configured based on the options provided with this command. If no
+options are set, the default behavior is to remove permissions for the
+specified user.
-{USAGE_PREFIX} user create [OPTIONS] <USERNAME> <PASSWORD>
+The command replaces the full permission set of the user. If only
+--global-permissions is set, stream permissions are removed. If only
+--stream-permissions is set, all global permissions are set to false.
-Arguments:
- <USERNAME>
- Username
-{CLAP_INDENT}
- Unique identifier for the user account on iggy server,
- must be between 3 and 50 characters long.
+Examples:
+ iggy user permissions 2
+ iggy user permissions client
- <PASSWORD>
- Password
-{CLAP_INDENT}
- Password of the user, must be between 3 and 100 characters long.
+{USAGE_PREFIX} user permissions [OPTIONS] <USER_ID>
-Options:
- -u, --user-status <USER_STATUS>
- User status
+Arguments:
+ <USER_ID>
+ User ID to update
{CLAP_INDENT}
- [default: active]
- [possible values: active, inactive]
+ The user ID can be specified as either a username or an ID
+Options:
-g, --global-permissions <GLOBAL_PERMISSIONS>
- Set global permissions for created user
+ Set global permissions for the user
{CLAP_INDENT}
All global permissions by default are set to false and this command
line option
allows to set each permission individually. Permissions are separated
@@ -284,11 +281,11 @@ Options:
read_topics / r_top, poll_messages / p_msg, send_messages / s_msg
{CLAP_INDENT}
Examples:
- iggy user create guest guess --global-permissions p_msg,s_msg
- iggy user create admin pass#1%X! -g
m_srv,r_srv,m_usr,r_usr,m_str,r_str,m_top,r_top,p_msg,s_msg
+ iggy user permissions guest --global-permissions p_msg,s_msg
+ iggy user permissions admin -g
m_srv,r_srv,m_usr,r_usr,m_str,r_str,m_top,r_top,p_msg,s_msg
-s, --stream-permissions <STREAM_PERMISSIONS>
- Set stream permissions for created user
+ Set stream permissions for the user
{CLAP_INDENT}
Stream permissions are defined by each stream separately. Setting
permission for stream
allows to set each permission individually, by default, if no
permission is provided
@@ -314,10 +311,10 @@ Options:
Permissions format:
STREAM_ID\[:STREAM_PERMISSIONS\]\[#TOPIC_ID\[:TOPIC_PERMISSIONS\]\]
{CLAP_INDENT}
Examples:
- iggy user create guest guest -s 1:manage_topics,read_topics
- iggy user create admin p@Ss! --stream-permissions
2:m_str,r_str,m_top,r_top,p_msg,s_msg
- iggy user create sender s3n43r -s 3#1:s_msg#2:s_msg
- iggy user create user1 test12 -s
4:manage_stream,r_top#1:s_msg,p_msg#2:manage_topic
+ iggy user permissions guest -s 1:manage_topics,read_topics
+ iggy user permissions admin --stream-permissions
2:m_str,r_str,m_top,r_top,p_msg,s_msg
+ iggy user permissions sender -s 3#1:s_msg#2:s_msg
+ iggy user permissions user1 -s
4:manage_stream,r_top#1:s_msg,p_msg#2:manage_topic
-h, --help
Print help (see a summary with '-h')
@@ -344,8 +341,8 @@ Arguments:
<USER_ID> User ID to update
Options:
- -g, --global-permissions <GLOBAL_PERMISSIONS> Set global permissions for
created user
- -s, --stream-permissions <STREAM_PERMISSIONS> Set stream permissions for
created user
+ -g, --global-permissions <GLOBAL_PERMISSIONS> Set global permissions for
the user
+ -s, --stream-permissions <STREAM_PERMISSIONS> Set stream permissions for
the user
-h, --help Print help (see more with
'--help')
"#,
),