Skip to content

Commit

Permalink
rgw: Do not modify email if argument is not set
Browse files Browse the repository at this point in the history
The RGW Admin OPS API overwrites the users email either it is not set via argument, e.g. when executing /{admin}/user?uid=test5&suspended=true.

Signed-off-by: Volker Theile <vtheile@suse.com>
  • Loading branch information
votdev committed May 16, 2018
1 parent 5820d71 commit c6792a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions qa/tasks/radosgw_admin_rest.py
Expand Up @@ -254,6 +254,7 @@ def task(ctx, config):
(ret, out) = rgwadmin_rest(admin_conn, ['user', 'info'], {'uid' : user1})
assert ret == 200
assert out['suspended']
assert out['email'] == email

# TESTCASE 're-enable','user','enable','suspended user','succeeds'
(ret, out) = rgwadmin_rest(admin_conn, ['user', 'modify'], {'uid' : user1, 'suspended' : 'false'})
Expand Down
9 changes: 6 additions & 3 deletions src/rgw/rgw_rest_user.cc
Expand Up @@ -212,7 +212,7 @@ void RGWOp_User_Modify::execute()
bool gen_key;
bool suspended;
bool system;

bool email_set;
bool quota_set;
int32_t max_buckets;

Expand All @@ -222,7 +222,7 @@ void RGWOp_User_Modify::execute()
rgw_user uid(uid_str);

RESTArgs::get_string(s, "display-name", display_name, &display_name);
RESTArgs::get_string(s, "email", email, &email);
RESTArgs::get_string(s, "email", email, &email, &email_set);
RESTArgs::get_string(s, "access-key", access_key, &access_key);
RESTArgs::get_string(s, "secret-key", secret_key, &secret_key);
RESTArgs::get_string(s, "user-caps", caps, &caps);
Expand All @@ -241,7 +241,10 @@ void RGWOp_User_Modify::execute()

op_state.set_user_id(uid);
op_state.set_display_name(display_name);
op_state.set_user_email(email);

if (email_set)
op_state.set_user_email(email);

op_state.set_caps(caps);
op_state.set_access_key(access_key);
op_state.set_secret_key(secret_key);
Expand Down

0 comments on commit c6792a8

Please sign in to comment.