Skip to content

Commit

Permalink
rgw: get bucket_owner from policy
Browse files Browse the repository at this point in the history
We already read the bucket policy, we can get the bucket
owner from there.

Signed-off-by: Yehuda Sadeh <[email protected]>
  • Loading branch information
yehudasa committed Feb 7, 2013
1 parent f6af1e7 commit 70532d1
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,22 +300,11 @@ int rgw_build_policies(RGWRados *store, struct req_state *s, bool only_bucket, b
}
s->bucket = bucket_info.bucket;

if (s->user.user_id.compare(bucket_info.owner) != 0) {
ret = rgw_get_user_info_by_uid(store, bucket_info.owner, bucket_owner_info);
if (ret < 0) {
ldout(s->cct, 0) << "NOTICE: couldn't get bucket owner info for (id=" << bucket_info.owner << ")" << dendl;
return ret;
}

s->bucket_owner.set_id(bucket_info.owner);
s->bucket_owner.set_name(bucket_owner_info.display_name);
} else {
s->bucket_owner = s->owner;
}

string no_obj;
RGWAccessControlPolicy bucket_acl(s->cct);
ret = read_policy(store, s, bucket_info, s->bucket_acl, s->bucket, no_obj);

s->bucket_owner = s->bucket_acl->get_owner();
}

/* we're passed only_bucket = true when we specifically need the bucket's
Expand Down

0 comments on commit 70532d1

Please sign in to comment.