Skip to content

Commit

Permalink
rgw: code changes to include tenant in replicated metadata
Browse files Browse the repository at this point in the history
for roles.

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
  • Loading branch information
pritha-srivastava committed Jun 6, 2022
1 parent a4caa0b commit 0d96b29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/rgw/rgw_role.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const string RGWRole::role_arn_prefix = "arn:aws:iam::";
void RGWRoleInfo::dump(Formatter *f) const
{
encode_json("RoleId", id , f);
encode_json("RoleName", name , f);
std::string role_name = tenant + '$' + name;
encode_json("RoleName", role_name , f);
encode_json("Path", path, f);
encode_json("Arn", arn, f);
encode_json("CreateDate", creation_date, f);
Expand Down Expand Up @@ -68,6 +69,10 @@ void RGWRoleInfo::decode_json(JSONObj *obj)
JSONDecoder::decode_json("CreateDate", creation_date, obj);
JSONDecoder::decode_json("MaxSessionDuration", max_session_duration, obj);
JSONDecoder::decode_json("AssumeRolePolicyDocument", trust_policy, obj);
if (auto pos = name.find('$'); pos != std::string::npos) {
tenant = name.substr(0, pos);
name = name.substr(pos+1);
}
}

RGWRole::RGWRole(std::string name,
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_role.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class RGWRoleMetadataObject: public RGWMetadataObject {
Store* store;
public:
RGWRoleMetadataObject() = default;
RGWRoleMetadataObject(RGWRoleInfo info,
RGWRoleMetadataObject(RGWRoleInfo& info,
const obj_version& v,
real_time m,
Store* store) : RGWMetadataObject(v,m), info(info), store(store) {}
Expand Down

0 comments on commit 0d96b29

Please sign in to comment.