]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw:user email can modify to empty
authorWeijun Duan <duanweijun@h3c.com>
Sat, 27 Feb 2016 09:28:14 +0000 (04:28 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 5 Oct 2016 18:34:21 +0000 (11:34 -0700)
Fixes: http://tracker.ceph.com/issues/13286
Signed-off-by: Weijun Duan <duanweijun@h3c.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_user.cc

index a7a732f22f1df93f2d47f07f993bb76193a103b1..0ba2f2bab197d85404d37d3c936d86575c097df4 100644 (file)
@@ -2105,6 +2105,7 @@ int main(int argc, char **argv)
       secret_key = val;
     } else if (ceph_argparse_witharg(args, i, &val, "-e", "--email", (char*)NULL)) {
       user_email = val;
+      user_op.user_email_specified=true;
     } else if (ceph_argparse_witharg(args, i, &val, "-n", "--display-name", (char*)NULL)) {
       display_name = val;
     } else if (ceph_argparse_witharg(args, i, &val, "-b", "--bucket", (char*)NULL)) {
index d4104c45b24602f816f7fe6b0f54161077101815..23f9e73d65cfc41cd9a03d67fa2ac59e00494e32 100644 (file)
@@ -2150,8 +2150,17 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg)
       }
     }
     user_info.user_email = op_email;
-  }
+  } else if (op_email.empty() && op_state.user_email_specified) {
 
+    rgw_obj email_obj(store->zone.user_email_pool, user_info.user_email);
+    ldout(store->ctx(), 10) << "removing email index: " << user_info.user_email << dendl;
+    ret = store->delete_system_obj(email_obj);
+    if (ret < 0 && ret != -ENOENT) {
+      ldout(store->ctx(), 0) << "ERROR: could not remove " << user_info.user_id << ":" << email_obj << ", should be fixed (err=" << ret << ")" << dendl;
+      return ret;
+    }
+    user_info.user_email = "";
+  }
 
   // update the remaining user info
   if (!display_name.empty())