Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make canned ACL optional #20

Merged
merged 5 commits into from
Sep 26, 2017
Merged

Conversation

hkupty
Copy link
Contributor

@hkupty hkupty commented Sep 25, 2017

So, in this case, no acl will be set to the object,
causing it to inherit the bucket rules.

This won't break anything, but allow ohnosequences/sbt-s3-resolver#54 to be solved.

So, in this case, no acl will be set to the object,
causing it to inherit the bucket rules.
Copy link
Contributor

@laughedelic laughedelic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea and the implementation is really simple 👌

I think this library isn't used anywhere except the sbt plugin 😅 So I'm more concerned about keeping the interface nice (see the comment below) and not afraid of breaking things here (also it's still not v1.x).

Also, if you could write a simple test for this case, it would be much appreciated. Smth like having a mock-bucket with a preset ACL and then putting an object (without ACL parameter) and checking that the resulting ACL is the one of the bucket.


if (acl != null){
request.setCannedAcl(acl);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check looks good on its own, but I don't like the idea of passing null when you want to leave ACL unset.

How about changing its type in the S3Repository constructor to Optional<CannedAccessControlList> and adjusting the other constructors accordingly?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second that. I'd even encourage making that change comprehensively wherever applicable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I totally agree with that, I avoided breaking the contract with what is currently stablished.
This seemed the minimum effort to make it happen.

Nonetheless, makes sense. I'll fix this.

@@ -0,0 +1,2 @@
* Allowed `CannedAccessControlList` to be null, in which case no specific ACL is set for the object;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for keeping changelog 👍
Rename the file to changelog.md, please. Then the release pipeline will pick it up and rename to the corresponding version. I think it will be 0.13.0 rather than 0.12.1, because it's not a bug fix, but a feature 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, makes sense. I'll change that as well.

@hkupty
Copy link
Contributor Author

hkupty commented Sep 25, 2017

Also, if you could write a simple test for this case, it would be much appreciated. Smth like having a mock-bucket with a preset ACL and then putting an object (without ACL parameter) and checking that the resulting ACL is the one of the bucket.

Most of the requested changes are in place, except for the test. I'm not really sure we can test the result ACL is the one of the bucket since, AFAIK, this happens on server side, when you send a request with no ACL attached.

Copy link
Contributor

@laughedelic laughedelic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One little thing. Other than that looks good 👍

@@ -94,6 +95,26 @@ public S3Repository(
.withRegion(region.toString())
.build(),
overwrite,
Optional.of(acl),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, change this to .ofNullable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Will fix

@laughedelic
Copy link
Contributor

I'm not really sure we can test the result ACL is the one of the bucket since, AFAIK, this happens on server side, when you send a request with no ACL attached.

Makes sense. I forgot that PutObjectRequest just takes a bucket name and doesn't know anything about its permissions.

@hkupty
Copy link
Contributor Author

hkupty commented Sep 26, 2017

I did some checks locally and the S3Resolver was missing. Changed there as well.
I'm hoping that this can be merged soon, but I totally understand if anything else needs changing.

Thanks for accepting the issue and both PRs.
Cheers,
Henry Kupty.

@laughedelic laughedelic changed the title Allow null canned acl Make canned ACL optional Sep 26, 2017
@laughedelic
Copy link
Contributor

Great! Thanks @hkupty!

@laughedelic laughedelic merged commit d4dfe42 into ohnosequences:master Sep 26, 2017
@laughedelic
Copy link
Contributor

@hkupty hkupty deleted the no-obj-acl branch September 26, 2017 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants