Skip to content

Commit

Permalink
Merge pull request #11340 from yehudasa/wip-13286
Browse files Browse the repository at this point in the history
rgw-admin: allow unsetting user's email

Reviewed-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed Oct 5, 2016
2 parents a35b7f6 + 10dbfc5 commit cf17858
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rgw/rgw_admin.cc
Expand Up @@ -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)) {
Expand Down
10 changes: 9 additions & 1 deletion src/rgw/rgw_user.cc
Expand Up @@ -2150,8 +2150,16 @@ 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) {

ldout(store->ctx(), 10) << "removing email index: " << user_info.user_email << dendl;
ret = rgw_remove_email_index(store, user_info.user_email);
if (ret < 0 && ret != -ENOENT) {
ldout(store->ctx(), 0) << "ERROR: could not remove " << user_info.user_id << " index (err=" << ret << ")" << dendl;
return ret;
}
user_info.user_email = "";
}

// update the remaining user info
if (!display_name.empty())
Expand Down

0 comments on commit cf17858

Please sign in to comment.