]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Do not modify email if argument is not set 22352/head
authorVolker Theile <vtheile@suse.com>
Wed, 16 May 2018 07:52:51 +0000 (09:52 +0200)
committerPrashant D <pdhange@redhat.com>
Fri, 1 Jun 2018 00:02:45 +0000 (20:02 -0400)
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>
(cherry picked from commit c6792a8be2fc1496e7a76b0e6b2579d32556b6b3)

qa/tasks/radosgw_admin_rest.py
src/rgw/rgw_rest_user.cc

index 7bd72d19536c1854ec923ea3616a883dd53416c1..99a742f13b9e18efc2b9bf7d0e38c272227ba925 100644 (file)
@@ -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'})
index 84194bfa8c0347c48c69a5b8bf4aa44ee0189451..ee526e3c03a41fdc80e1d834dbebf3c192d47c58 100644 (file)
@@ -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;
 
@@ -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);
@@ -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);