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

How to set permissions on files? #407

Closed
danyaljj opened this issue Jun 17, 2016 · 14 comments
Closed

How to set permissions on files? #407

danyaljj opened this issue Jun 17, 2016 · 14 comments
Assignees

Comments

@danyaljj
Copy link

Is it possible to make an object private and another one public? (like accessible by anonymous)? (at the time of putting object with putObject)

@GarimaKapoor
Copy link

All objects by default are uploaded as private on putObject. To make an object public, you would use Set Bucket Policy API explicitly. For golang we have implemented the bucket policy API https://github.com/minio/minio-go/blob/master/API.md#SetBucketPolicy
If you need this API soon we will implement and make a new release soon. Server already has support.

@danyaljj
Copy link
Author

I need it in the java api. Would be great if you add this setting.

@GarimaKapoor
Copy link

Sure, on it :)

@danyaljj
Copy link
Author

Any ideas when this will be available?

@GarimaKapoor
Copy link

Right now all of us are working on the stable release of the server. Once we get that out (one week from now), we will start working this API as priority.

@nl5887
Copy link
Contributor

nl5887 commented Jul 11, 2016

@danyaljj expect it this week. We're documenting and testing now.

@danyaljj
Copy link
Author

Some clarification:
So I see the policies here: https://github.com/minio/minio-java/blob/master/src/main/java/io/minio/policy/BucketPolicy.java#L20-L24

I wonder how they match to what I want. What I want is:

  • Some objects should be private, meaning that you'd get them only if you have the right username-pass.
  • Some objects should be public, meaning that you can get them even if you don't have username-password.

Now what is not clear is how I can use the existing policies (readOnly, writeOnly, etc) to simulate the above two behavior; any ideas?

@harshavardhana
Copy link
Member

Some clarification:
So I see the policies here: https://github.com/minio/minio-java/blob/master/src/main/java/io/minio/policy/BucketPolicy.java#L20-L24

I wonder how they match to what I want. What I want is:

Some objects should be private, meaning that you'd get them only if you have the right username-pass.

By default all objects are private.

Some objects should be public, meaning that you can get them even if you don't have username-password.

Normally publicly available objects are kept inside a prefix as 'public' all you have to do now is

setBucketPolicy(bucket, "public", BucketPolicy.ReadOnly)

Now what is not clear is how I can use the existing policies (readOnly, writeOnly, etc) to simulate the above two behavior; any ideas?

@danyaljj
Copy link
Author

Thanks for clarifying it; two other questions;

@harshavardhana
Copy link
Member

what are statements?: https://github.com/minio/minio-java/blob/master/src/main/java/io/minio/MinioClient.java#L2190-L2192

A statement is a representation of the policies you have it is a standardized format published by AWS S3. http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

what are other possibly values for the 2nd argument other than "public"?

Any object prefix, "public" is just as an example. For example you can have 2015/photos/old

In this example the 2nd argument ("my-objectname") is wrong?

why is that? "my-objectname" is just a placeholder you can name it whatever you feel like.

@danyaljj
Copy link
Author

Just to make sure I understand: setting the BucketPolicy to ReadOnly would make the bucket public?

@harshavardhana
Copy link
Member

Just to make sure I understand: setting the BucketPolicy to ReadOnly would make the bucket public?

Bucket policies are quite elaborate from what S3 implements, what is provided with minio-java is a more consumable variant by trimming down the details to bare minimal.

Setting a bucket policy in this form.

SetBucketPolicy('testbucket', '', BucketPolicy.ReadOnly) - would make your entire bucket i.e 'testbucket' publicly readable. Notice second argument is missing.

SetBucketPolicy('testbucket', '2015/photos', BucketPolicy.ReadOnly - would make all the objects in 'testbucket' falling under the prefix 2015/photos to be publicly readable. Notice the second argument is provided.

@danyaljj
Copy link
Author

danyaljj commented Aug 2, 2016

I think BucketPolicy has been added recently and there hasn't been any release after that; right?

@harshavardhana
Copy link
Member

I think BucketPolicy has been added recently and there hasn't been any release after that; right?

We haven't made one, because there are some more changes which are pending @balamurugana is working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants