From b472d769d12a82582bb033ee6ff8d5a3f60b2c9c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 14 Dec 2023 14:40:34 -0800 Subject: [PATCH] change_user_role: List role choices in --help output. Fixes #28227. Signed-off-by: Anders Kaseorg --- .../management/commands/change_user_role.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/zerver/management/commands/change_user_role.py b/zerver/management/commands/change_user_role.py index f6f2db8a54..ca02f4fe87 100644 --- a/zerver/management/commands/change_user_role.py +++ b/zerver/management/commands/change_user_role.py @@ -13,6 +13,17 @@ from zerver.actions.users import ( from zerver.lib.management import ZulipBaseCommand from zerver.models import UserProfile +ROLE_CHOICES = [ + "owner", + "admin", + "moderator", + "member", + "guest", + "can_forge_sender", + "can_create_users", + "is_billing_admin", +] + class Command(ZulipBaseCommand): help = """Change role of an existing user in their (own) Realm. @@ -26,17 +37,8 @@ ONLY perform this on customer request from an authorized person. parser.add_argument( "new_role", metavar="", - choices=[ - "owner", - "admin", - "moderator", - "member", - "guest", - "can_forge_sender", - "can_create_users", - "is_billing_admin", - ], - help="new role of the user", + choices=ROLE_CHOICES, + help="new role of the user; choose from " + ", ".join(ROLE_CHOICES), ) parser.add_argument( "--revoke",