]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW Zipper - zipify RGWUserAdminOpState
authorDaniel Gryniewicz <dang@redhat.com>
Tue, 19 Jan 2021 19:58:39 +0000 (14:58 -0500)
committerDaniel Gryniewicz <dang@redhat.com>
Tue, 2 Mar 2021 12:35:05 +0000 (07:35 -0500)
Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_cr_tools.cc
src/rgw/rgw_rest_user.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h
src/rgw/rgw_user.cc
src/rgw/rgw_user.h

index 94ee98bbbf3f00473f758f6ec310e2aae8c9f228..dee4ae9ce2da8cf5f2619efd6b6cfcad8c854da6 100644 (file)
@@ -3004,6 +3004,7 @@ int main(int argc, const char **argv)
 
   common_init_finish(g_ceph_context);
 
+  rgw_user user_id_arg;
   std::unique_ptr<rgw::sal::RGWUser> user;
   string tenant;
   string user_ns;
@@ -3068,7 +3069,6 @@ int main(int argc, const char **argv)
   map<string, bool> categories;
   string caps;
   int check_objects = false;
-  RGWUserAdminOpState user_op;
   RGWBucketAdminOpState bucket_op;
   string infile;
   string metadata_key;
@@ -3210,13 +3210,11 @@ int main(int argc, const char **argv)
     if (ceph_argparse_double_dash(args, i)) {
       break;
     } else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
-      rgw_user user_id;
-      user_id.from_str(val);
-      if (!user) {
+      user_id_arg.from_str(val);
+      if (user_id_arg.empty()) {
         cerr << "no value for uid" << std::endl;
         exit(1);
       }
-      user = store->get_user(user_id);
     } else if (ceph_argparse_witharg(args, i, &val, "-i", "--new-uid", (char*)NULL)) {
       new_user_id.from_str(val);
     } else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
@@ -3232,7 +3230,6 @@ int main(int argc, const 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)) {
@@ -3870,6 +3867,15 @@ int main(int argc, const char **argv)
     return 5; //EIO
   }
 
+  /* Needs to be after the store is initialized */
+  if (!user_id_arg.empty()) {
+    user = store->get_user(user_id_arg);
+  }
+  RGWUserAdminOpState user_op(store);
+  if (!user_email.empty()) {
+    user_op.user_email_specified=true;
+  }
+
   if (!source_zone_name.empty()) {
     if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(source_zone_name, &source_zone)) {
       cerr << "WARNING: cannot find source zone id for name=" << source_zone_name << std::endl;
index 57c76ced60bbbb397ce73259de86d7dc10605765..f6eee0d207effdb0590b8987fee5164c396a1881 100644 (file)
@@ -23,7 +23,7 @@ int RGWUserCreateCR::Request::_send_request()
   const int32_t default_max_buckets =
     cct->_conf.get_val<int64_t>("rgw_user_max_buckets");
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   auto& user = params.user;
 
index 9c53adef585a31e7d5e2e32f7de31f1b79c7ba0a..a87c64992c3978e994c45bb63af9e41dea0f48ac 100644 (file)
@@ -33,7 +33,7 @@ public:
 
 void RGWOp_User_List::execute(optional_yield y)
 {
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   uint32_t max_entries;
   std::string marker;
@@ -61,7 +61,7 @@ public:
 
 void RGWOp_User_Info::execute(optional_yield y)
 {
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   std::string uid_str, access_key_str;
   bool fetch_stats;
@@ -129,7 +129,7 @@ void RGWOp_User_Create::execute(optional_yield y)
   const int32_t default_max_buckets =
     s->cct->_conf.get_val<int64_t>("rgw_user_max_buckets");
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -267,7 +267,7 @@ void RGWOp_User_Modify::execute(optional_yield y)
   bool quota_set;
   int32_t max_buckets;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -394,7 +394,7 @@ void RGWOp_User_Remove::execute(optional_yield y)
   std::string uid_str;
   bool purge_data;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -446,7 +446,7 @@ void RGWOp_Subuser_Create::execute(optional_yield y)
   uint32_t perm_mask = 0;
   int32_t key_type = KEY_TYPE_SWIFT;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -514,7 +514,7 @@ void RGWOp_Subuser_Modify::execute(optional_yield y)
   std::string key_type_str;
   std::string perm_str;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   uint32_t perm_mask;
   int32_t key_type = KEY_TYPE_SWIFT;
@@ -579,7 +579,7 @@ void RGWOp_Subuser_Remove::execute(optional_yield y)
   std::string subuser;
   bool purge_keys;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -626,7 +626,7 @@ void RGWOp_Key_Create::execute(optional_yield y)
 
   bool gen_key;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -679,7 +679,7 @@ void RGWOp_Key_Remove::execute(optional_yield y)
   std::string access_key;
   std::string key_type_str;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -724,7 +724,7 @@ void RGWOp_Caps_Add::execute(optional_yield y)
   std::string uid_str;
   std::string caps;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -762,7 +762,7 @@ void RGWOp_Caps_Remove::execute(optional_yield y)
   std::string uid_str;
   std::string caps;
 
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   rgw_user uid(uid_str);
@@ -817,7 +817,7 @@ public:
 
 void RGWOp_Quota_Info::execute(optional_yield y)
 {
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   std::string uid_str;
   std::string quota_type;
@@ -936,7 +936,7 @@ public:
 
 void RGWOp_Quota_Set::execute(optional_yield y)
 {
-  RGWUserAdminOpState op_state;
+  RGWUserAdminOpState op_state(store);
 
   std::string uid_str;
   std::string quota_type;
index 7a742f3c9c4137d1cdd2bd19b953d56c04b94462..a0dcfce7f06e104cdae98a58626e45d14e57704e 100644 (file)
@@ -273,6 +273,7 @@ class RGWUser {
     /* Placeholders */
     virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y) = 0;
     virtual int store_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::PutParams& params = {}) = 0;
+    virtual int remove_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::RemoveParams& params = {}) = 0;
 
     /* dang temporary; will be removed when User is complete */
     RGWUserInfo& get_info() { return info; }
index 5f4b385bc2f3d80a37c2bba791a94f8477174ede..6f0a18a6e941c83816d126cc441ab4b571596ef9 100644 (file)
@@ -197,6 +197,11 @@ int RGWRadosUser::store_info(const DoutPrefixProvider *dpp, optional_yield y, co
     return store->ctl()->user->store_info(dpp, info, y, params);
 }
 
+int RGWRadosUser::remove_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::RemoveParams& params)
+{
+    return store->ctl()->user->remove_info(dpp, info, y, params);
+}
+
 /* Placeholder */
 RGWObject *RGWRadosBucket::create_object(const rgw_obj_key &key)
 {
index 9899cbb4456b4ff5c8729689b3ea5c2aa2e3112b..ebe5eae0db20444beccfffb717e1c6325358393e 100644 (file)
@@ -64,6 +64,7 @@ class RGWRadosUser : public RGWUser {
     /* Placeholders */
     virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y) override;
     virtual int store_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::PutParams& params = {}) override;
+    virtual int remove_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::RemoveParams& params = {}) override;
 
     friend class RGWRadosBucket;
 };
index 4339baf9fa9a675cfb4e56091af108bad3dca878..c8a1a8f298adbf9a1b07ee03b33d1fed94522d8f 100644 (file)
@@ -409,7 +409,6 @@ void rgw_filter_attrset(map<string, bufferlist>& unfiltered_attrset, const strin
 
 RGWDataAccess::RGWDataAccess(rgw::sal::RGWStore *_store) : store(_store)
 {
-  sysobj_ctx = std::make_unique<RGWSysObjectCtx>(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx());
 }
 
 
index ff50eba158adddd7068d0cdda7ea2ed377b3db83..d2c08284d8ed487aaad47d0e0d3a403d8b77b805 100644 (file)
@@ -143,7 +143,6 @@ using RGWMD5Etag = RGWEtag<MD5, CEPH_CRYPTO_MD5_DIGESTSIZE>;
 class RGWDataAccess
 {
   rgw::sal::RGWStore *store;
-  std::unique_ptr<RGWSysObjectCtx> sysobj_ctx;
 
 public:
   RGWDataAccess(rgw::sal::RGWStore *_store);
index 643258a9410ffe67be6a8b19f3f4af7baac9365a..3051c0b2bb2342285abf409b9da42ffb6aef9541 100644 (file)
@@ -472,7 +472,7 @@ int RGWAccessKeyPool::init(RGWUserAdminOpState& op_state)
     return -EINVAL;
   }
 
-  rgw_user& uid = op_state.get_user_id();
+  const rgw_user& uid = op_state.get_user_id();
   if (uid.compare(RGW_USER_ANON_ID) == 0) {
     keys_allowed = false;
     return -EACCES;
@@ -486,6 +486,112 @@ int RGWAccessKeyPool::init(RGWUserAdminOpState& op_state)
   return 0;
 }
 
+RGWUserAdminOpState::RGWUserAdminOpState(rgw::sal::RGWStore* store)
+{
+  user = store->get_user(rgw_user(RGW_USER_ANON_ID));
+}
+
+void RGWUserAdminOpState::set_user_id(const rgw_user& id)
+{
+  if (id.empty())
+    return;
+
+  user->get_info().user_id = id;
+}
+
+void RGWUserAdminOpState::set_subuser(std::string& _subuser)
+{
+  if (_subuser.empty())
+    return;
+
+  size_t pos = _subuser.find(":");
+  if (pos != string::npos) {
+    rgw_user tmp_id;
+    tmp_id.from_str(_subuser.substr(0, pos));
+    if (tmp_id.tenant.empty()) {
+      user->get_info().user_id.id = tmp_id.id;
+    } else {
+      user->get_info().user_id = tmp_id;
+    }
+    subuser = _subuser.substr(pos+1);
+  } else {
+    subuser = _subuser;
+  }
+
+  subuser_specified = true;
+}
+
+void RGWUserAdminOpState::set_user_info(RGWUserInfo& user_info)
+{
+  user->get_info() = user_info;
+}
+
+const rgw_user& RGWUserAdminOpState::get_user_id()
+{
+  return user->get_id();
+}
+
+RGWUserInfo& RGWUserAdminOpState::get_user_info()
+{
+  return user->get_info();
+}
+
+map<std::string, RGWAccessKey>* RGWUserAdminOpState::get_swift_keys()
+{
+  return &user->get_info().swift_keys;
+}
+
+map<std::string, RGWAccessKey>* RGWUserAdminOpState::get_access_keys()
+{
+  return &user->get_info().access_keys;
+}
+
+map<std::string, RGWSubUser>* RGWUserAdminOpState::get_subusers()
+{
+  return &user->get_info().subusers;
+}
+
+RGWUserCaps *RGWUserAdminOpState::get_caps_obj()
+{
+  return &user->get_info().caps;
+}
+
+std::string RGWUserAdminOpState::build_default_swift_kid()
+{
+  if (user->get_id().empty() || subuser.empty())
+    return "";
+
+  std::string kid;
+  user->get_id().to_str(kid);
+  kid.append(":");
+  kid.append(subuser);
+
+  return kid;
+}
+
+std::string RGWUserAdminOpState::generate_subuser() {
+  if (user->get_id().empty())
+    return "";
+
+  std::string generated_subuser;
+  user->get_id().to_str(generated_subuser);
+  std::string rand_suffix;
+
+  int sub_buf_size = RAND_SUBUSER_LEN + 1;
+  char sub_buf[RAND_SUBUSER_LEN + 1];
+
+  gen_rand_alphanumeric_upper(g_ceph_context, sub_buf, sub_buf_size);
+
+  rand_suffix = sub_buf;
+  if (rand_suffix.empty())
+    return "";
+
+  generated_subuser.append(rand_suffix);
+  subuser = generated_subuser;
+
+  return generated_subuser;
+}
+
 /*
  * Do a fairly exhaustive search for an existing key matching the parameters
  * given. Also handles the case where no key type was specified and updates
@@ -1004,7 +1110,7 @@ int RGWSubUserPool::init(RGWUserAdminOpState& op_state)
     return -EINVAL;
   }
 
-  rgw_user& uid = op_state.get_user_id();
+  const rgw_user& uid = op_state.get_user_id();
   if (uid.compare(RGW_USER_ANON_ID) == 0) {
     subusers_allowed = false;
     return -EACCES;
@@ -1307,7 +1413,7 @@ int RGWUserCapPool::init(RGWUserAdminOpState& op_state)
     return -EINVAL;
   }
 
-  rgw_user& uid = op_state.get_user_id();
+  const rgw_user& uid = op_state.get_user_id();
   if (uid.compare(RGW_USER_ANON_ID) == 0) {
     caps_allowed = false;
     return -EACCES;
@@ -1577,7 +1683,7 @@ int RGWUser::check_op(RGWUserAdminOpState& op_state, std::string *err_msg)
 {
   bool same_id;
   bool populated;
-  rgw_user& op_id = op_state.get_user_id();
+  const rgw_user& op_id = op_state.get_user_id();
 
   RGWUserInfo user_info;
 
@@ -1742,7 +1848,7 @@ int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_
 
   RGWUserInfo user_info;
 
-  rgw_user& uid = op_state.get_user_id();
+  const rgw_user& uid = op_state.get_user_id();
   std::string user_email = op_state.get_user_email();
   std::string display_name = op_state.get_display_name();
 
@@ -1756,7 +1862,7 @@ int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_
       set_err_msg(err_msg, "duplicate key provided");
       ret = -ERR_KEY_EXIST;
     } else {
-      set_err_msg(err_msg, "user: " + op_state.user_id.to_str() + " exists");
+      set_err_msg(err_msg, "user: " + uid.to_str() + " exists");
       ret = -EEXIST;
     }
     return ret;
index 21ae057e252c6bf38b7383af2ee8d76d0cb08601..a6e374775907bbcc103406865d3b702344e2cebe 100644 (file)
@@ -156,87 +156,86 @@ enum RGWUserId {
  */
 struct RGWUserAdminOpState {
   // user attributes
-  RGWUserInfo info;
-  rgw_user user_id;
+  std::unique_ptr<rgw::sal::RGWUser> user;
   std::string user_email;
   std::string display_name;
   rgw_user new_user_id;
   bool overwrite_new_user = false;
-  int32_t max_buckets;
-  __u8 suspended;
-  __u8 admin;
-  __u8 system;
-  __u8 exclusive;
-  __u8 fetch_stats;
-  __u8 sync_stats;
+  int32_t max_buckets{RGW_DEFAULT_MAX_BUCKETS};
+  __u8 suspended{0};
+  __u8 admin{0};
+  __u8 system{0};
+  __u8 exclusive{0};
+  __u8 fetch_stats{0};
+  __u8 sync_stats{0};
   std::string caps;
   RGWObjVersionTracker objv;
-  uint32_t op_mask;
+  uint32_t op_mask{0};
   map<int, string> temp_url_keys;
 
   // subuser attributes
   std::string subuser;
-  uint32_t perm_mask;
+  uint32_t perm_mask{RGW_PERM_NONE};
 
   // key_attributes
   std::string id; // access key
   std::string key; // secret key
-  int32_t key_type;
+  int32_t key_type{-1};
 
   std::set<string> mfa_ids;
 
   // operation attributes
-  bool existing_user;
-  bool existing_key;
-  bool existing_subuser;
-  bool existing_email;
-  bool subuser_specified;
-  bool gen_secret;
-  bool gen_access;
-  bool gen_subuser;
-  bool id_specified;
-  bool key_specified;
-  bool type_specified;
-  bool key_type_setbycontext;   // key type set by user or subuser context
-  bool purge_data;
-  bool purge_keys;
-  bool display_name_specified;
-  bool user_email_specified;
-  bool max_buckets_specified;
-  bool perm_specified;
-  bool op_mask_specified;
-  bool caps_specified;
-  bool suspension_op;
-  bool admin_specified = false;
-  bool system_specified;
-  bool key_op;
-  bool temp_url_key_specified;
-  bool found_by_uid
-  bool found_by_email;  
-  bool found_by_key;
-  bool mfa_ids_specified;
+  bool existing_user{false};
+  bool existing_key{false};
+  bool existing_subuser{false};
+  bool existing_email{false};
+  bool subuser_specified{false};
+  bool gen_secret{false};
+  bool gen_access{false};
+  bool gen_subuser{false};
+  bool id_specified{false};
+  bool key_specified{false};
+  bool type_specified{false};
+  bool key_type_setbycontext{false};   // key type set by user or subuser context
+  bool purge_data{false};
+  bool purge_keys{false};
+  bool display_name_specified{false};
+  bool user_email_specified{false};
+  bool max_buckets_specified{false};
+  bool perm_specified{false};
+  bool op_mask_specified{false};
+  bool caps_specified{false};
+  bool suspension_op{false};
+  bool admin_specified{false};
+  bool system_specified{false};
+  bool key_op{false};
+  bool temp_url_key_specified{false};
+  bool found_by_uid{false};
+  bool found_by_email{false};
+  bool found_by_key{false};
+  bool mfa_ids_specified{false};
  
   // req parameters
-  bool populated;
-  bool initialized;
-  bool key_params_checked;
-  bool subuser_params_checked;
-  bool user_params_checked;
+  bool populated{false};
+  bool initialized{false};
+  bool key_params_checked{false};
+  bool subuser_params_checked{false};
+  bool user_params_checked{false};
 
-  bool bucket_quota_specified;
-  bool user_quota_specified;
+  bool bucket_quota_specified{false};
+  bool user_quota_specified{false};
 
   RGWQuotaInfo bucket_quota;
   RGWQuotaInfo user_quota;
 
   // req parameters for listing user
-  std::string marker;
-  uint32_t max_entries;
+  std::string marker{""};
+  uint32_t max_entries{1000};
   rgw_placement_rule default_placement; // user default placement
-  bool default_placement_specified;
+  bool default_placement_specified{false};
 
   list<string> placement_tags;  // user default placement_tags
-  bool placement_tags_specified;
+  bool placement_tags_specified{false};
 
   void set_access_key(const std::string& access_key) {
     if (access_key.empty())
@@ -258,12 +257,7 @@ struct RGWUserAdminOpState {
     key_op = true;
   }
 
-  void set_user_id(const rgw_user& id) {
-    if (id.empty())
-      return;
-
-    user_id = id;
-  }
+  void set_user_id(const rgw_user& id);
 
   void set_new_user_id(const rgw_user& id) {
     if (id.empty())
@@ -290,26 +284,7 @@ struct RGWUserAdminOpState {
     display_name_specified = true;
   }
 
-  void set_subuser(std::string& _subuser) {
-    if (_subuser.empty())
-      return;
-
-    size_t pos = _subuser.find(":");
-    if (pos != string::npos) {
-      rgw_user tmp_id;
-      tmp_id.from_str(_subuser.substr(0, pos));
-      if (tmp_id.tenant.empty()) {
-        user_id.id = tmp_id.id;
-      } else {
-        user_id = tmp_id;
-      }
-      subuser = _subuser.substr(pos+1);
-    } else {
-      subuser = _subuser;
-    }
-
-    subuser_specified = true;
-  }
+  void set_subuser(std::string& _subuser);
 
   void set_caps(const std::string& _caps) {
     if (_caps.empty())
@@ -366,10 +341,7 @@ struct RGWUserAdminOpState {
     sync_stats = is_sync_stats;
   }
 
-  void set_user_info(RGWUserInfo& user_info) {
-    user_id = user_info.user_id;
-    info = user_info;
-  }
+  void set_user_info(RGWUserInfo& user_info);
 
   void set_max_buckets(int32_t mb) {
     max_buckets = mb;
@@ -467,7 +439,7 @@ struct RGWUserAdminOpState {
   RGWQuotaInfo& get_user_quota() { return user_quota; }
   set<string>& get_mfa_ids() { return mfa_ids; }
 
-  rgw_user& get_user_id() { return user_id; }
+  const rgw_user& get_user_id();
   std::string get_subuser() { return subuser; }
   std::string get_access_key() { return id; }
   std::string get_secret_key() { return key; }
@@ -478,101 +450,19 @@ struct RGWUserAdminOpState {
   bool get_overwrite_new_user() const { return overwrite_new_user; }
   map<int, std::string>& get_temp_url_keys() { return temp_url_keys; }
 
-  RGWUserInfo&  get_user_info() { return info; }
+  RGWUserInfo&  get_user_info();
 
-  map<std::string, RGWAccessKey> *get_swift_keys() { return &info.swift_keys; }
-  map<std::string, RGWAccessKey> *get_access_keys() { return &info.access_keys; }
-  map<std::string, RGWSubUser> *get_subusers() { return &info.subusers; }
+  map<std::string, RGWAccessKey>* get_swift_keys();
+  map<std::string, RGWAccessKey>* get_access_keys();
+  map<std::string, RGWSubUser>* get_subusers();
 
-  RGWUserCaps *get_caps_obj() { return &info.caps; }
+  RGWUserCaps* get_caps_obj();
 
-  std::string build_default_swift_kid() {
-    if (user_id.empty() || subuser.empty())
-      return "";
+  std::string build_default_swift_kid();
 
-    std::string kid;
-    user_id.to_str(kid);
-    kid.append(":");
-    kid.append(subuser);
+  std::string generate_subuser();
 
-    return kid;
-  }
-
-  std::string generate_subuser() {
-    if (user_id.empty())
-      return "";
-
-    std::string generated_subuser;
-    user_id.to_str(generated_subuser);
-    std::string rand_suffix;
-
-    int sub_buf_size = RAND_SUBUSER_LEN + 1;
-    char sub_buf[RAND_SUBUSER_LEN + 1];
-
-    gen_rand_alphanumeric_upper(g_ceph_context, sub_buf, sub_buf_size);
-
-    rand_suffix = sub_buf;
-    if (rand_suffix.empty())
-      return "";
-
-    generated_subuser.append(rand_suffix);
-    subuser = generated_subuser;
-
-    return generated_subuser;
-  }
-
-  RGWUserAdminOpState() : user_id(RGW_USER_ANON_ID)
-  {
-    max_buckets = RGW_DEFAULT_MAX_BUCKETS;
-    key_type = -1;
-    perm_mask = RGW_PERM_NONE;
-    suspended = 0;
-    admin = 0;
-    system = 0;
-    exclusive = 0;
-    fetch_stats = 0;
-    op_mask = 0;
-
-    existing_user = false;
-    existing_key = false;
-    existing_subuser = false;
-    existing_email = false;
-    subuser_specified = false;
-    caps_specified = false;
-    purge_keys = false;
-    gen_secret = false;
-    gen_access = false;
-    gen_subuser = false;
-    id_specified = false;
-    key_specified = false;
-    type_specified = false;
-    key_type_setbycontext = false;
-    purge_data = false;
-    display_name_specified = false;
-    user_email_specified = false;
-    max_buckets_specified = false;
-    perm_specified = false;
-    op_mask_specified = false;
-    suspension_op = false;
-    system_specified = false;
-    key_op = false;
-    populated = false;
-    initialized = false;
-    key_params_checked = false;
-    subuser_params_checked = false;
-    user_params_checked = false;
-    bucket_quota_specified = false;
-    temp_url_key_specified = false;
-    user_quota_specified = false;
-    found_by_uid = false;
-    found_by_email = false;
-    found_by_key = false;
-    mfa_ids_specified = false;
-    default_placement_specified = false;
-    placement_tags_specified = false;
-    max_entries = 1000;
-    marker = "";
-  }
+  RGWUserAdminOpState(rgw::sal::RGWStore* store);
 };
 
 class RGWUser;