From 3f1cd1b44a8ef60c6f8fd460df5559145a059930 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 1 Nov 2023 15:48:33 -0400 Subject: [PATCH] rgw: add account_id to RGWUserInfo Signed-off-by: Casey Bodley --- src/rgw/rgw_common.cc | 2 ++ src/rgw/rgw_common.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index b47b1ba749d58..538f8d50b33fa 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -2794,6 +2794,7 @@ void RGWUserInfo::dump(Formatter *f) const } encode_json("type", user_source_type, f); encode_json("mfa_ids", mfa_ids, f); + encode_json("account_id", account_id, f); } void RGWUserInfo::decode_json(JSONObj *obj) @@ -2845,6 +2846,7 @@ void RGWUserInfo::decode_json(JSONObj *obj) type = TYPE_NONE; } JSONDecoder::decode_json("mfa_ids", mfa_ids, obj); + JSONDecoder::decode_json("account_id", account_id, obj); } diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index cb613b23b8d9f..f9adb2d1a8338 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -579,6 +579,7 @@ struct RGWUserInfo RGWQuota quota; uint32_t type; std::set mfa_ids; + rgw_account_id account_id; RGWUserInfo() : suspended(0), @@ -601,7 +602,7 @@ struct RGWUserInfo } void encode(bufferlist& bl) const { - ENCODE_START(22, 9, bl); + ENCODE_START(23, 9, bl); encode((uint64_t)0, bl); // old auid std::string access_key; std::string secret_key; @@ -648,10 +649,11 @@ struct RGWUserInfo encode(assumed_role_arn, bl); } encode(user_id.ns, bl); + encode(account_id, bl); ENCODE_FINISH(bl); } void decode(bufferlist::const_iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN_32(22, 9, 9, bl); + DECODE_START_LEGACY_COMPAT_LEN_32(23, 9, 9, bl); if (struct_v >= 2) { uint64_t old_auid; decode(old_auid, bl); @@ -738,6 +740,9 @@ struct RGWUserInfo } else { user_id.ns.clear(); } + if (struct_v >= 23) { + decode(account_id, bl); + } DECODE_FINISH(bl); } void dump(Formatter *f) const; -- 2.39.5