Merge pull request #599 from harshavardhana/pr_out_add_new_option_for_bucket_acl_named_authenticated_read_to_provide_read_access_to_all_users_who_are_part_of_authenticatedusers_group
This commit is contained in:
@@ -24,6 +24,8 @@ func (b bucketACL) isValidBucketACL() bool {
|
||||
case b.isReadOnly():
|
||||
fallthrough
|
||||
case b.isPublic():
|
||||
fallthrough
|
||||
case b.isAuthenticated():
|
||||
return true
|
||||
case b.String() == "private":
|
||||
// by default its "private"
|
||||
@@ -38,9 +40,10 @@ type bucketACL string
|
||||
|
||||
// different types of ACL's currently supported for buckets
|
||||
const (
|
||||
bucketPrivate = bucketACL("private")
|
||||
bucketReadOnly = bucketACL("readonly")
|
||||
bucketPublic = bucketACL("public")
|
||||
bucketPrivate = bucketACL("private")
|
||||
bucketReadOnly = bucketACL("readonly")
|
||||
bucketPublic = bucketACL("public")
|
||||
bucketAuthenticated = bucketACL("authenticated")
|
||||
)
|
||||
|
||||
func (b bucketACL) String() string {
|
||||
@@ -53,6 +56,9 @@ func (b bucketACL) String() string {
|
||||
if string(b) == "public" {
|
||||
return "public-read-write"
|
||||
}
|
||||
if string(b) == "authenticated" {
|
||||
return "authenticated-read"
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
@@ -70,3 +76,8 @@ func (b bucketACL) isReadOnly() bool {
|
||||
func (b bucketACL) isPublic() bool {
|
||||
return b == bucketPublic
|
||||
}
|
||||
|
||||
// IsAuthenticated - is acl AuthenticatedRead
|
||||
func (b bucketACL) isAuthenticated() bool {
|
||||
return b == bucketAuthenticated
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ EXAMPLES:
|
||||
2. Set bucket to "public" on Amazon S3 object storage
|
||||
$ mc {{.Name}} public https://s3.amazonaws.com/shared
|
||||
|
||||
3. Set bucket to "authenticated" on Amazon S3 object storage to provide read access to AuthenticatedUsers group
|
||||
$ mc {{.Name}} authenticated https://s3.amazonaws.com/shared-authenticated
|
||||
|
||||
3. Set folder to world readwrite (chmod 777) on local filesystem
|
||||
$ mc {{.Name}} public /shared/Music
|
||||
|
||||
|
||||
@@ -233,6 +233,8 @@ func isValidBucketACL(acl string) bool {
|
||||
fallthrough
|
||||
case "public-read-write":
|
||||
fallthrough
|
||||
case "authenticated-read":
|
||||
fallthrough
|
||||
case "":
|
||||
return true
|
||||
default:
|
||||
@@ -249,6 +251,8 @@ func aclToPerm(acl string) os.FileMode {
|
||||
return os.FileMode(0500)
|
||||
case "public-read-write":
|
||||
return os.FileMode(0777)
|
||||
case "authenticated-read":
|
||||
return os.FileMode(0770)
|
||||
default:
|
||||
return os.FileMode(0700)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ func isValidBucketACL(acl string) bool {
|
||||
case "public-read":
|
||||
fallthrough
|
||||
case "public-read-write":
|
||||
fallthrough
|
||||
case "authenticated-read":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
||||
@@ -81,6 +81,7 @@ func (s *MySuite) TestBucketACL(c *C) {
|
||||
{"private", true},
|
||||
{"public-read", true},
|
||||
{"public-read-write", true},
|
||||
{"authenticated-read", true},
|
||||
{"", false},
|
||||
{"readonly", false},
|
||||
{"invalid", false},
|
||||
|
||||
Reference in New Issue
Block a user