mirror of
https://github.com/minio/minio.git
synced 2024-12-29 00:23:21 -05:00
48 lines
1022 B
Go
48 lines
1022 B
Go
package xl
|
|
|
|
// BucketACL - bucket level access control
|
|
type BucketACL string
|
|
|
|
// different types of ACL's currently supported for buckets
|
|
const (
|
|
BucketPrivate = BucketACL("private")
|
|
BucketPublicRead = BucketACL("public-read")
|
|
BucketPublicReadWrite = BucketACL("public-read-write")
|
|
)
|
|
|
|
func (b BucketACL) String() string {
|
|
return string(b)
|
|
}
|
|
|
|
// IsPrivate - is acl Private
|
|
func (b BucketACL) IsPrivate() bool {
|
|
return b == BucketACL("private")
|
|
}
|
|
|
|
// IsPublicRead - is acl PublicRead
|
|
func (b BucketACL) IsPublicRead() bool {
|
|
return b == BucketACL("public-read")
|
|
}
|
|
|
|
// IsPublicReadWrite - is acl PublicReadWrite
|
|
func (b BucketACL) IsPublicReadWrite() bool {
|
|
return b == BucketACL("public-read-write")
|
|
}
|
|
|
|
// IsValidBucketACL - is provided acl string supported
|
|
func IsValidBucketACL(acl string) bool {
|
|
switch acl {
|
|
case "private":
|
|
fallthrough
|
|
case "public-read":
|
|
fallthrough
|
|
case "public-read-write":
|
|
return true
|
|
case "":
|
|
// by default its "private"
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|