forked from TrueCloudLab/frostfs-s3-gw
[#352] Add appending of SetEACL token in authmate
If Put session context exists Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
aa4c9d19f6
commit
e7e71d6202
1 changed files with 18 additions and 0 deletions
|
@ -384,6 +384,24 @@ func buildContext(rules []byte) ([]*session.ContainerContext, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal rules for session token: %w", err)
|
||||
}
|
||||
|
||||
var (
|
||||
containsPut = false
|
||||
containsSetEACL = false
|
||||
)
|
||||
for _, s := range sessionCtxs {
|
||||
if s.IsForPut() {
|
||||
containsPut = true
|
||||
} else if s.IsForSetEACL() {
|
||||
containsSetEACL = true
|
||||
}
|
||||
}
|
||||
if containsPut && !containsSetEACL {
|
||||
ectx := session.NewContainerContext()
|
||||
ectx.ForSetEACL()
|
||||
sessionCtxs = append(sessionCtxs, ectx)
|
||||
}
|
||||
|
||||
return sessionCtxs, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue