MCPcopy
hub / github.com/minio/minio-go / getObjectPolicy

Function getObjectPolicy

pkg/policy/bucket-policy.go:538–551  ·  view source on GitHub ↗

Returns policy of given object statement.

(statement Statement)

Source from the content-addressed store, hash-verified

536
537// Returns policy of given object statement.
538func getObjectPolicy(statement Statement) (readOnly, writeOnly bool) {
539 if statement.Effect == "Allow" &&
540 statement.Principal.AWS.Contains("*") &&
541 statement.Conditions == nil {
542 if statement.Actions.Intersection(readOnlyObjectActions).Equals(readOnlyObjectActions) {
543 readOnly = true
544 }
545 if statement.Actions.Intersection(writeOnlyObjectActions).Equals(writeOnlyObjectActions) {
546 writeOnly = true
547 }
548 }
549
550 return readOnly, writeOnly
551}
552
553// GetPolicy - Returns policy of given bucket name, prefix in given statements.
554func GetPolicy(statements []Statement, bucketName, prefix string) BucketPolicy {

Callers 2

GetPolicyFunction · 0.85
TestGetObjectPolicyFunction · 0.85

Calls 3

ContainsMethod · 0.45
EqualsMethod · 0.45
IntersectionMethod · 0.45

Tested by 1

TestGetObjectPolicyFunction · 0.68