Skip to content

Commit

Permalink
rgw: add account_id to RGWUserInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed Apr 10, 2024
1 parent 59bbd65 commit 3f1cd1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/rgw/rgw_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}


Expand Down
9 changes: 7 additions & 2 deletions src/rgw/rgw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ struct RGWUserInfo
RGWQuota quota;
uint32_t type;
std::set<std::string> mfa_ids;
rgw_account_id account_id;

RGWUserInfo()
: suspended(0),
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3f1cd1b

Please sign in to comment.