mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
Merge pull request #13460 from theanalyst/fix/rgw-rest-user-fixme
wip: rgw: rest_admin/user avoid double checking input args Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
commit
e7d7b8d035
@ -108,23 +108,12 @@ void RGWOp_User_Create::execute()
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: don't do double argument checking
|
||||
if (!uid.empty())
|
||||
// TODO: validate required args are passed in. (for eg. uid and display_name here)
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!display_name.empty())
|
||||
op_state.set_display_name(display_name);
|
||||
|
||||
if (!email.empty())
|
||||
op_state.set_user_email(email);
|
||||
|
||||
if (!caps.empty())
|
||||
op_state.set_caps(caps);
|
||||
|
||||
if (!access_key.empty())
|
||||
op_state.set_access_key(access_key);
|
||||
|
||||
if (!secret_key.empty())
|
||||
op_state.set_secret_key(secret_key);
|
||||
|
||||
if (!key_type_str.empty()) {
|
||||
@ -239,22 +228,11 @@ void RGWOp_User_Modify::execute()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!display_name.empty())
|
||||
op_state.set_display_name(display_name);
|
||||
|
||||
if (!email.empty())
|
||||
op_state.set_user_email(email);
|
||||
|
||||
if (!caps.empty())
|
||||
op_state.set_caps(caps);
|
||||
|
||||
if (!access_key.empty())
|
||||
op_state.set_access_key(access_key);
|
||||
|
||||
if (!secret_key.empty())
|
||||
op_state.set_secret_key(secret_key);
|
||||
|
||||
if (max_buckets != RGW_DEFAULT_MAX_BUCKETS)
|
||||
@ -364,19 +342,10 @@ void RGWOp_Subuser_Create::execute()
|
||||
perm_mask = rgw_str_to_perm(perm_str.c_str());
|
||||
op_state.set_perm(perm_mask);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!subuser.empty())
|
||||
op_state.set_subuser(subuser);
|
||||
|
||||
if (!access_key.empty())
|
||||
op_state.set_access_key(access_key);
|
||||
|
||||
if (!secret_key.empty())
|
||||
op_state.set_secret_key(secret_key);
|
||||
|
||||
op_state.set_generate_subuser(gen_subuser);
|
||||
|
||||
if (gen_access)
|
||||
@ -437,17 +406,9 @@ void RGWOp_Subuser_Modify::execute()
|
||||
perm_mask = rgw_str_to_perm(perm_str.c_str());
|
||||
op_state.set_perm(perm_mask);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!subuser.empty())
|
||||
op_state.set_subuser(subuser);
|
||||
|
||||
if (!secret_key.empty())
|
||||
op_state.set_secret_key(secret_key);
|
||||
|
||||
if (gen_secret)
|
||||
op_state.set_gen_secret();
|
||||
|
||||
if (!key_type_str.empty()) {
|
||||
@ -489,11 +450,7 @@ void RGWOp_Subuser_Remove::execute()
|
||||
RESTArgs::get_string(s, "subuser", subuser, &subuser);
|
||||
RESTArgs::get_bool(s, "purge-keys", true, &purge_keys);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!subuser.empty())
|
||||
op_state.set_subuser(subuser);
|
||||
|
||||
if (purge_keys)
|
||||
@ -537,17 +494,9 @@ void RGWOp_Key_Create::execute()
|
||||
RESTArgs::get_string(s, "key-type", key_type_str, &key_type_str);
|
||||
RESTArgs::get_bool(s, "generate-key", true, &gen_key);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!subuser.empty())
|
||||
op_state.set_subuser(subuser);
|
||||
|
||||
if (!access_key.empty())
|
||||
op_state.set_access_key(access_key);
|
||||
|
||||
if (!secret_key.empty())
|
||||
op_state.set_secret_key(secret_key);
|
||||
|
||||
if (gen_key)
|
||||
@ -596,14 +545,8 @@ void RGWOp_Key_Remove::execute()
|
||||
RESTArgs::get_string(s, "access-key", access_key, &access_key);
|
||||
RESTArgs::get_string(s, "key-type", key_type_str, &key_type_str);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!subuser.empty())
|
||||
op_state.set_subuser(subuser);
|
||||
|
||||
if (!access_key.empty())
|
||||
op_state.set_access_key(access_key);
|
||||
|
||||
if (!key_type_str.empty()) {
|
||||
@ -645,11 +588,7 @@ void RGWOp_Caps_Add::execute()
|
||||
|
||||
RESTArgs::get_string(s, "user-caps", caps, &caps);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!caps.empty())
|
||||
op_state.set_caps(caps);
|
||||
|
||||
http_ret = RGWUserAdminOp_Caps::add(store, op_state, flusher);
|
||||
@ -681,11 +620,7 @@ void RGWOp_Caps_Remove::execute()
|
||||
|
||||
RESTArgs::get_string(s, "user-caps", caps, &caps);
|
||||
|
||||
// FIXME: no double checking
|
||||
if (!uid.empty())
|
||||
op_state.set_user_id(uid);
|
||||
|
||||
if (!caps.empty())
|
||||
op_state.set_caps(caps);
|
||||
|
||||
http_ret = RGWUserAdminOp_Caps::remove(store, op_state, flusher);
|
||||
|
Loading…
Reference in New Issue
Block a user