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

Function newObjectStatement

pkg/policy/bucket-policy.go:207–231  ·  view source on GitHub ↗

Returns new statements contains object actions for given policy.

(policy BucketPolicy, bucketName, prefix string)

Source from the content-addressed store, hash-verified

205
206// Returns new statements contains object actions for given policy.
207func newObjectStatement(policy BucketPolicy, bucketName, prefix string) (statements []Statement) {
208 statements = []Statement{}
209 if policy == BucketPolicyNone || bucketName == "" {
210 return statements
211 }
212
213 statement := Statement{
214 Effect: "Allow",
215 Principal: User{AWS: set.CreateStringSet("*")},
216 Resources: set.CreateStringSet(awsResourcePrefix + bucketName + "/" + prefix + "*"),
217 Sid: "",
218 }
219
220 switch policy {
221 case BucketPolicyReadOnly:
222 statement.Actions = readOnlyObjectActions
223 case BucketPolicyWriteOnly:
224 statement.Actions = writeOnlyObjectActions
225 case BucketPolicyReadWrite:
226 statement.Actions = readWriteObjectActions
227 }
228
229 statements = append(statements, statement)
230 return statements
231}
232
233// Returns new statements for given policy, bucket and prefix.
234func newStatements(policy BucketPolicy, bucketName, prefix string) (statements []Statement) {

Callers 1

newStatementsFunction · 0.85

Calls 1

CreateStringSetFunction · 0.92

Tested by

no test coverage detected