RGWAccessKeyPool::RGWAccessKeyPool(RGWUser* usr)
{
- user = usr;
- swift_keys = NULL;
- access_keys = NULL;
-
- if (!user) {
- keys_allowed = false;
- store = NULL;
+ if (!usr) {
return;
}
- keys_allowed = true;
+ user = usr;
store = user->get_store();
-}
-
-RGWAccessKeyPool::~RGWAccessKeyPool()
-{
-
+ user_ctl = user->get_user_ctl();
}
int RGWAccessKeyPool::init(RGWUserAdminOpState& op_state)
RGWSubUserPool::RGWSubUserPool(RGWUser *usr)
{
- subusers_allowed = (usr != NULL);
- if (usr)
- store = usr->get_store();
- else
- store = NULL;
- user = usr;
- subuser_map = NULL;
-}
+ if (!usr) {
+ return;
+ }
-RGWSubUserPool::~RGWSubUserPool()
-{
+ user = usr;
+ subusers_allowed = true;
+ store = user->get_store();
+ user_ctl = user->get_user_ctl();
}
int RGWSubUserPool::init(RGWUserAdminOpState& op_state)
RGWUserCapPool::RGWUserCapPool(RGWUser *usr)
{
+ if (!usr) {
+ return;
+ }
user = usr;
- caps = NULL;
- caps_allowed = (user != NULL);
-}
-
-RGWUserCapPool::~RGWUserCapPool()
-{
-
+ caps_allowed = true;
}
int RGWUserCapPool::init(RGWUserAdminOpState& op_state)
return 0;
}
-RGWUser::RGWUser() : store(NULL), info_stored(false), caps(this), keys(this), subusers(this)
+RGWUser::RGWUser() : caps(this), keys(this), subusers(this)
{
init_default();
}
return 0;
}
-RGWUser::~RGWUser()
-{
-}
-
void RGWUser::init_default()
{
// use anonymous user info as a placeholder
}
store = storage;
+ user_ctl = *store->ctl.user;
clear_populated();
class RGWAccessKeyPool
{
- RGWUser *user;
+ RGWUser *user{nullptr};
std::map<std::string, int, ltstr_nocase> key_type_map;
rgw_user user_id;
- RGWRados *store;
+ RGWRados *store{nullptr};
+ RGWUserCtl *user_ctl{nullptr};
- map<std::string, RGWAccessKey> *swift_keys;
- map<std::string, RGWAccessKey> *access_keys;
+ map<std::string, RGWAccessKey> *swift_keys{nullptr};
+ map<std::string, RGWAccessKey> *access_keys{nullptr};
// we don't want to allow keys for the anonymous user or a null user
- bool keys_allowed;
+ bool keys_allowed{false};
private:
int create_key(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
public:
explicit RGWAccessKeyPool(RGWUser* usr);
- ~RGWAccessKeyPool();
int init(RGWUserAdminOpState& op_state);
class RGWSubUserPool
{
- RGWUser *user;
+ RGWUser *user{nullptr};
rgw_user user_id;
- RGWRados *store;
- bool subusers_allowed;
+ RGWRados *store{nullptr};
+ RGWUserCtl *user_ctl{nullptr};
+ bool subusers_allowed{false};
- map<string, RGWSubUser> *subuser_map;
+ map<string, RGWSubUser> *subuser_map{nullptr};
private:
int check_op(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
int modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
public:
explicit RGWSubUserPool(RGWUser *user);
- ~RGWSubUserPool();
bool exists(std::string subuser);
int init(RGWUserAdminOpState& op_state);
class RGWUserCapPool
{
- RGWUserCaps *caps;
- bool caps_allowed;
- RGWUser *user;
+ RGWUserCaps *caps{false};
+ bool caps_allowed{false};
+ RGWUser *user{false};
private:
int add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
public:
explicit RGWUserCapPool(RGWUser *user);
- ~RGWUserCapPool();
int init(RGWUserAdminOpState& op_state);
private:
RGWUserInfo old_info;
- RGWRados *store;
+ RGWRados *store{nullptr};
+ RGWUserCtl *user_ctl{nullptr};
rgw_user user_id;
- bool info_stored;
+ bool info_stored{false};
void set_populated() { info_stored = true; }
void clear_populated() { info_stored = false; }
public:
RGWUser();
- ~RGWUser();
int init(RGWRados *storage, RGWUserAdminOpState& op_state);
int init_members(RGWUserAdminOpState& op_state);
RGWRados *get_store() { return store; }
+ RGWUserCtl *get_user_ctl() { return user_ctl; }
/* API Contracted Members */
RGWUserCapPool caps;