X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fcli_commands%2Frbac.py;h=fcad9632f7e4879a6782a3640b1414d73874e003;hb=08d655951c662042f370edc7f7d75cb7d3b3846a;hp=25e72d01bfaf37c674890cf2b1d8ee70c8f95838;hpb=d1ccf0e88aeacb065b97a6c5cb82e6de53537b94;p=osm%2Fosmclient.git diff --git a/osmclient/cli_commands/rbac.py b/osmclient/cli_commands/rbac.py index 25e72d0..fcad963 100755 --- a/osmclient/cli_commands/rbac.py +++ b/osmclient/cli_commands/rbac.py @@ -333,13 +333,6 @@ def user_create(ctx, username, password, projects, project_role_mappings, domain @click.command(name="user-update", short_help="updates user information") @click.argument("username") -@click.option( - "--password", - # prompt=True, - # hide_input=True, - # confirmation_prompt=True, - help="user password", -) @click.option("--set-username", "set_username", default=None, help="change username") @click.option( "--set-project", @@ -369,11 +362,14 @@ def user_create(ctx, username, password, projects, project_role_mappings, domain multiple=True, help="remove role(s) in a project. Can be used several times: 'project,role1[,role2,...]'", ) -@click.option("--change_password", "change_password", help="user's current password") +@click.option("--current-password", "current_password", help="user's current password") @click.option( - "--new_password", + "--new-password", "new_password", - help="user's new password to update in expiry condition", + prompt=True, + hide_input=True, + confirmation_prompt=True, + help="new user password", ) @click.option( "--unlock", @@ -389,13 +385,12 @@ def user_create(ctx, username, password, projects, project_role_mappings, domain def user_update( ctx, username, - password, set_username, set_project, remove_project, add_project_role, remove_project_role, - change_password, + current_password, new_password, unlock, renew, @@ -404,34 +399,34 @@ def user_update( \b USERNAME: name of the user - PASSWORD: new password SET_USERNAME: new username SET_PROJECT: creating mappings for project/role(s) REMOVE_PROJECT: deleting mappings for project/role(s) ADD_PROJECT_ROLE: adding mappings for project/role(s) REMOVE_PROJECT_ROLE: removing mappings for project/role(s) - CHANGE_PASSWORD: user's current password to change - NEW_PASSWORD: user's new password to update in expiry condition + CURRENT_PASSWORD: user's current password to change + NEW_PASSWORD: user's new password to be updated UNLOCK: unlock user RENEW: renew user """ logger.debug("") user = {} - user["password"] = password user["username"] = set_username user["set-project"] = set_project user["remove-project"] = remove_project user["add-project-role"] = add_project_role user["remove-project-role"] = remove_project_role - user["change_password"] = change_password + user["current_password"] = current_password user["new_password"] = new_password user["unlock"] = unlock user["renew"] = renew utils.check_client_version(ctx.obj, ctx.command.name) - if not user.get("change_password"): + if not user.get("current_password"): + # In case the password is valid but the end user wants to update it ctx.obj.user.update(username, user) else: + # In case the password has expired (also applies in first login) ctx.obj.user.update(username, user, pwd_change=True)