|
28 | 28 | DefaultAccelerationConfigurationStatus = svcsdk.BucketAccelerateStatusSuspended |
29 | 29 | DefaultRequestPayer = svcsdk.PayerBucketOwner |
30 | 30 | DefaultVersioningStatus = svcsdk.BucketVersioningStatusSuspended |
| 31 | + DefaultACL = svcsdk.BucketCannedACLPrivate |
31 | 32 | DefaultPolicy = "" |
32 | 33 | ) |
33 | 34 |
|
@@ -314,7 +315,42 @@ func customPreCompare( |
314 | 315 | if b.ko.Spec.ACL != nil { |
315 | 316 | b.ko.Spec.ACL = matchPossibleCannedACL(*a.ko.Spec.ACL, *b.ko.Spec.ACL) |
316 | 317 | } |
| 318 | + } else { |
| 319 | + // If we are sure the grants weren't set from the header strings |
| 320 | + if a.ko.Spec.GrantFullControl == nil && |
| 321 | + a.ko.Spec.GrantRead == nil && |
| 322 | + a.ko.Spec.GrantReadACP == nil && |
| 323 | + a.ko.Spec.GrantWrite == nil && |
| 324 | + a.ko.Spec.GrantWriteACP == nil { |
| 325 | + b.ko.Spec.GrantFullControl = nil |
| 326 | + b.ko.Spec.GrantRead = nil |
| 327 | + b.ko.Spec.GrantReadACP = nil |
| 328 | + b.ko.Spec.GrantWrite = nil |
| 329 | + b.ko.Spec.GrantWriteACP = nil |
| 330 | + } |
| 331 | + |
| 332 | + emptyGrant := "" |
| 333 | + if a.ko.Spec.GrantFullControl == nil && b.ko.Spec.GrantFullControl != nil { |
| 334 | + a.ko.Spec.GrantFullControl = &emptyGrant |
| 335 | + // TODO(RedbackThomson): Remove the following line. GrantFullControl |
| 336 | + // has a server-side default of id="<owner ID>". This field needs to |
| 337 | + // be marked as such before we can diff it. |
| 338 | + b.ko.Spec.GrantFullControl = &emptyGrant |
| 339 | + } |
| 340 | + if a.ko.Spec.GrantRead == nil && b.ko.Spec.GrantRead != nil { |
| 341 | + a.ko.Spec.GrantRead = &emptyGrant |
| 342 | + } |
| 343 | + if a.ko.Spec.GrantReadACP == nil && b.ko.Spec.GrantReadACP != nil { |
| 344 | + a.ko.Spec.GrantReadACP = &emptyGrant |
| 345 | + } |
| 346 | + if a.ko.Spec.GrantWrite == nil && b.ko.Spec.GrantWrite != nil { |
| 347 | + a.ko.Spec.GrantWrite = &emptyGrant |
| 348 | + } |
| 349 | + if a.ko.Spec.GrantWriteACP == nil && b.ko.Spec.GrantWriteACP != nil { |
| 350 | + a.ko.Spec.GrantWriteACP = &emptyGrant |
| 351 | + } |
317 | 352 | } |
| 353 | + |
318 | 354 | if a.ko.Spec.CORS == nil && b.ko.Spec.CORS != nil { |
319 | 355 | a.ko.Spec.CORS = &svcapitypes.CORSConfiguration{} |
320 | 356 | } |
@@ -441,6 +477,16 @@ func (rm *resourceManager) newPutBucketACLPayload( |
441 | 477 | res.SetGrantWriteACP(*r.ko.Spec.GrantWriteACP) |
442 | 478 | } |
443 | 479 |
|
| 480 | + // Check that there is at least some ACL on the bucket |
| 481 | + if res.ACL == nil && |
| 482 | + res.GrantFullControl == nil && |
| 483 | + res.GrantRead == nil && |
| 484 | + res.GrantReadACP == nil && |
| 485 | + res.GrantWrite == nil && |
| 486 | + res.GrantWriteACP == nil { |
| 487 | + res.SetACL(DefaultACL) |
| 488 | + } |
| 489 | + |
444 | 490 | return res |
445 | 491 | } |
446 | 492 |
|
|
0 commit comments