|
|
@ -690,13 +690,15 @@ func getBucketAccessPolicy(objAPI ObjectLayer, bucketName string) (policy.Bucket |
|
|
|
policyInfo, err = layer.GetBucketPolicies(bucketName) |
|
|
|
policyInfo, err = layer.GetBucketPolicies(bucketName) |
|
|
|
case *azureObjects: |
|
|
|
case *azureObjects: |
|
|
|
policyInfo, err = layer.GetBucketPolicies(bucketName) |
|
|
|
policyInfo, err = layer.GetBucketPolicies(bucketName) |
|
|
|
|
|
|
|
case *gcsGateway: |
|
|
|
|
|
|
|
policyInfo, err = layer.GetBucketPolicies(bucketName) |
|
|
|
default: |
|
|
|
default: |
|
|
|
policyInfo, err = readBucketAccessPolicy(objAPI, bucketName) |
|
|
|
policyInfo, err = readBucketAccessPolicy(objAPI, bucketName) |
|
|
|
} |
|
|
|
} |
|
|
|
return policyInfo, err |
|
|
|
return policyInfo, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetBucketPolicy - get bucket policy.
|
|
|
|
// GetBucketPolicy - get bucket policy for the requested prefix.
|
|
|
|
func (web *webAPIHandlers) GetBucketPolicy(r *http.Request, args *GetBucketPolicyArgs, reply *GetBucketPolicyRep) error { |
|
|
|
func (web *webAPIHandlers) GetBucketPolicy(r *http.Request, args *GetBucketPolicyArgs, reply *GetBucketPolicyRep) error { |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
@ -707,10 +709,13 @@ func (web *webAPIHandlers) GetBucketPolicy(r *http.Request, args *GetBucketPolic |
|
|
|
return toJSONError(errAuthentication) |
|
|
|
return toJSONError(errAuthentication) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
policyInfo, err := readBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
var policyInfo, err = getBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
_, ok := errorCause(err).(PolicyNotFound) |
|
|
|
|
|
|
|
if !ok { |
|
|
|
return toJSONError(err, args.BucketName) |
|
|
|
return toJSONError(err, args.BucketName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reply.UIVersion = browser.UIVersion |
|
|
|
reply.UIVersion = browser.UIVersion |
|
|
|
reply.Policy = policy.GetPolicy(policyInfo.Statements, args.BucketName, args.Prefix) |
|
|
|
reply.Policy = policy.GetPolicy(policyInfo.Statements, args.BucketName, args.Prefix) |
|
|
@ -745,8 +750,8 @@ func (web *webAPIHandlers) ListAllBucketPolicies(r *http.Request, args *ListAllB |
|
|
|
if !isHTTPRequestValid(r) { |
|
|
|
if !isHTTPRequestValid(r) { |
|
|
|
return toJSONError(errAuthentication) |
|
|
|
return toJSONError(errAuthentication) |
|
|
|
} |
|
|
|
} |
|
|
|
var policyInfo, err = getBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var policyInfo, err = getBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
_, ok := errorCause(err).(PolicyNotFound) |
|
|
|
_, ok := errorCause(err).(PolicyNotFound) |
|
|
|
if !ok { |
|
|
|
if !ok { |
|
|
@ -791,7 +796,6 @@ func (web *webAPIHandlers) SetBucketPolicy(r *http.Request, args *SetBucketPolic |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var policyInfo, err = getBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
var policyInfo, err = getBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if _, ok := errorCause(err).(PolicyNotFound); !ok { |
|
|
|
if _, ok := errorCause(err).(PolicyNotFound); !ok { |
|
|
|
return toJSONError(err, args.BucketName) |
|
|
|
return toJSONError(err, args.BucketName) |
|
|
|