int fetch_access_keys_from_master(const DoutPrefixProvider* dpp, req_state* s,
std::map<std::string, RGWAccessKey>& keys,
+ ceph::real_time& create_date,
optional_yield y)
{
bufferlist data;
RGWUserInfo ui;
ui.decode_json(&jp);
keys = std::move(ui.access_keys);
+ create_date = ui.create_date;
return 0;
}
RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
RESTArgs::get_string(s, "account-id", "", &op_state.account_id);
+ RESTArgs::get_string(s, "path", "", &op_state.path);
if (!s->user->get_info().system && system) {
ldpp_dout(this, 0) << "cannot set system flag by non-system user" << dendl;
}
if (!s->penv.site->is_meta_master()) {
- op_ret = fetch_access_keys_from_master(this, s, op_state.op_access_keys, y);
+ op_state.create_date.emplace();
+ op_ret = fetch_access_keys_from_master(this, s, op_state.op_access_keys,
+ *op_state.create_date, y);
if (op_ret < 0) {
return;
}
RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
RESTArgs::get_string(s, "account-id", "", &op_state.account_id);
+ RESTArgs::get_string(s, "path", "", &op_state.path);
if (!s->user->get_info().system && system) {
ldpp_dout(this, 0) << "cannot set system flag by non-system user" << dendl;
}
if (!s->penv.site->is_meta_master()) {
- op_ret = fetch_access_keys_from_master(this, s, op_state.op_access_keys, y);
+ op_state.create_date.emplace();
+ op_ret = fetch_access_keys_from_master(this, s, op_state.op_access_keys,
+ *op_state.create_date, y);
if (op_ret < 0) {
return;
}
user_info.type = TYPE_ROOT;
}
+ if (!op_state.path.empty()) {
+ user_info.path = op_state.path;
+ } else {
+ user_info.path = "/";
+ }
+
+ if (op_state.create_date) {
+ user_info.create_date = *op_state.create_date;
+ } else {
+ user_info.create_date = ceph::real_clock::now();
+ }
+
// update the request
op_state.set_user_info(user_info);
op_state.set_populated();
user_info.type = op_state.account_root ? TYPE_ROOT : TYPE_RGW;
}
+ if (!op_state.path.empty()) {
+ user_info.path = op_state.path;
+ }
+
+ if (op_state.create_date) {
+ user_info.create_date = *op_state.create_date;
+ }
+
op_state.set_user_info(user_info);
// if we're supposed to modify keys, do so
uint32_t op_mask{0};
std::map<int, std::string> temp_url_keys;
std::string account_id;
+ std::string path;
+ std::optional<ceph::real_time> create_date;
// subuser attributes
std::string subuser;
if (!tags.empty()) {
user_op.set_placement_tags(tags);
}
+ user_op.path = path;
user_op.account_id = account_id;
bucket_op.account_id = account_id;
i->user_id = "user_id";
i->display_name = "display_name";
i->user_email = "user@email";
+ i->account_id = "RGW12345678901234567";
+ i->path = "/";
+ i->create_date = ceph::real_time{std::chrono::hours(1)};
+ i->tags.emplace("key", "value");
RGWAccessKey k1, k2;
k1.id = "id1";
k1.key = "key1";
encode_json("type", user_source_type, f);
encode_json("mfa_ids", mfa_ids, f);
encode_json("account_id", account_id, f);
+ encode_json("path", path, f);
+ encode_json("create_date", create_date, f);
+ encode_json("tags", tags, f);
}
void RGWUserInfo::decode_json(JSONObj *obj)
}
JSONDecoder::decode_json("mfa_ids", mfa_ids, obj);
JSONDecoder::decode_json("account_id", account_id, obj);
+ JSONDecoder::decode_json("path", path, obj);
+ JSONDecoder::decode_json("create_date", create_date, obj);
+ JSONDecoder::decode_json("tags", tags, obj);
}
uint32_t type;
std::set<std::string> mfa_ids;
rgw_account_id account_id;
+ std::string path = "/";
+ ceph::real_time create_date;
+ std::multimap<std::string, std::string> tags;
RGWUserInfo()
: suspended(0),
}
encode(user_id.ns, bl);
encode(account_id, bl);
+ encode(path, bl);
+ encode(create_date, bl);
+ encode(tags, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator& bl) {
}
if (struct_v >= 23) {
decode(account_id, bl);
+ decode(path, bl);
+ decode(create_date, bl);
+ decode(tags, bl);
+ } else {
+ path = "/";
}
DECODE_FINISH(bl);
}
}
}
+void decode_xml_obj(ceph::real_time& val, XMLObj *obj)
+{
+ const std::string s = obj->get_data();
+ uint64_t epoch;
+ uint64_t nsec;
+ int r = utime_t::parse_date(s, &epoch, &nsec);
+ if (r == 0) {
+ using namespace std::chrono;
+ val = real_time{seconds(epoch) + nanoseconds(nsec)};
+ } else {
+ throw RGWXMLDecoder::err("failed to decode real_time");
+ }
+}
+
void encode_xml(const char *name, const string& val, Formatter *f)
{
f->dump_string(name, val);
#include <iosfwd>
#include <include/types.h>
#include <common/Formatter.h>
+#include "common/ceph_time.h"
class XMLObj;
class RGWXMLParser;
void decode_xml_obj(bufferlist& val, XMLObj *obj);
class utime_t;
void decode_xml_obj(utime_t& val, XMLObj *obj);
+void decode_xml_obj(ceph::real_time& val, XMLObj *obj);
template<class T>
void decode_xml_obj(std::optional<T>& val, XMLObj *obj)