Browse Source

Merge branch '1_bucket_write' into 10_acl_merged

pull/4090/head
changlin.shi 2 years ago
parent
commit
7cacbefedc
  1. 2
      weed/s3api/s3api_acp.go
  2. 5
      weed/s3api/s3api_bucket_handlers.go

2
weed/s3api/s3api_acp.go

@ -402,7 +402,7 @@ func getObjectEntry(s3a *S3ApiServer, bucket, object string) (*filer_pb.Entry, e
func (s3a *S3ApiServer) ExtractBucketAcp(r *http.Request, objectOwnership string) (owner string, grants []*s3.Grant, errCode s3err.ErrorCode) {
accountId := s3acl.GetAccountId(r)
if objectOwnership == s3_constants.OwnershipBucketOwnerEnforced {
if objectOwnership == "" || objectOwnership == s3_constants.OwnershipBucketOwnerEnforced {
return accountId, []*s3.Grant{
{
Permission: &s3_constants.PermissionFullControl,

5
weed/s3api/s3api_bucket_handlers.go

@ -124,9 +124,6 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request)
}
objectOwnership := r.Header.Get("ObjectOwnership")
if objectOwnership == "" {
objectOwnership = s3_constants.DefaultOwnershipForCreate
}
acpOwner, acpGrants, errCode := s3a.ExtractBucketAcp(r, objectOwnership)
if errCode != s3err.ErrNone {
s3err.WriteErrorResponse(w, r, errCode)
@ -139,6 +136,8 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request)
entry.Extended = make(map[string][]byte)
}
entry.Extended[s3_constants.AmzIdentityId] = []byte(identityId)
}
if objectOwnership != "" {
entry.Extended[s3_constants.ExtOwnershipKey] = []byte(objectOwnership)
}
s3acl.AssembleEntryWithAcp(entry, acpOwner, acpGrants)

Loading…
Cancel
Save