Port: Use 'c' prefix for bucket policies instead of 'n' #361

Merged
alexvanin merged 2 commits from alexvanin/frostfs-s3-gw:fix/8574-master into master 2024-09-04 19:51:13 +00:00
Showing only changes of commit 61ff4702a2 - Show all commits

View file

@ -81,25 +81,19 @@ func policyCheck(r *http.Request, cfg PolicyConfig) error {
}
reqInfo := GetReqInfo(r.Context())
targets := []engine.RequestTarget{
engine.NewRequestTargetWithNamespace(reqInfo.Namespace),
}
target := engine.NewRequestTargetWithNamespace(reqInfo.Namespace)
if bktInfo != nil {
targets = append(targets, engine.NewRequestTargetWithContainer(bktInfo.CID.EncodeToString()))
cnrTarget := engine.ContainerTarget(bktInfo.CID.EncodeToString())
target.Container = &cnrTarget
}
st := chain.NoRuleFound
for _, target := range targets {
status, found, err := cfg.Storage.IsAllowed(chain.S3, target, req)
st, found, err := cfg.Storage.IsAllowed(chain.S3, target, req)
if err != nil {
return err
}
if found {
st = status
if status != chain.Allow {
break
}
}
if !found {
st = chain.NoRuleFound
}
switch {