diff --git a/acl.go b/acl.go index 396ab85f..c5c45dfc 100644 --- a/acl.go +++ b/acl.go @@ -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 +} diff --git a/cmd-options.go b/cmd-options.go index bb0ab2a4..b7de78ca 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -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 diff --git a/pkg/client/fs/fs.go b/pkg/client/fs/fs.go index a6f706ec..4389b711 100644 --- a/pkg/client/fs/fs.go +++ b/pkg/client/fs/fs.go @@ -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) } diff --git a/pkg/client/s3/bucket.go b/pkg/client/s3/bucket.go index 1b2155c5..42d022cc 100644 --- a/pkg/client/s3/bucket.go +++ b/pkg/client/s3/bucket.go @@ -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 diff --git a/pkg/client/s3/client_test.go b/pkg/client/s3/client_test.go index 52186f91..e8dc0dbc 100644 --- a/pkg/client/s3/client_test.go +++ b/pkg/client/s3/client_test.go @@ -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},