[#525] v2/container: Write session token from header to eACL table
If eACL table is set via session, then session token should be written to it. Write session token from request meta header to `eacl.Table` structure which is passed to `wrapper.PutEACL` function. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
5c2b8de87d
commit
b09f212990
2 changed files with 7 additions and 3 deletions
|
@ -20,7 +20,7 @@ type ServiceExecutor interface {
|
||||||
Delete(context.Context, *container.DeleteRequestBody) (*container.DeleteResponseBody, error)
|
Delete(context.Context, *container.DeleteRequestBody) (*container.DeleteResponseBody, error)
|
||||||
Get(context.Context, *container.GetRequestBody) (*container.GetResponseBody, error)
|
Get(context.Context, *container.GetRequestBody) (*container.GetResponseBody, error)
|
||||||
List(context.Context, *container.ListRequestBody) (*container.ListResponseBody, error)
|
List(context.Context, *container.ListRequestBody) (*container.ListResponseBody, error)
|
||||||
SetExtendedACL(context.Context, *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error)
|
SetExtendedACL(ContextWithToken, *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error)
|
||||||
GetExtendedACL(context.Context, *container.GetExtendedACLRequestBody) (*container.GetExtendedACLResponseBody, error)
|
GetExtendedACL(context.Context, *container.GetExtendedACLRequestBody) (*container.GetExtendedACLResponseBody, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func (s *executorSvc) List(ctx context.Context, req *container.ListRequest) (*co
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *executorSvc) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
func (s *executorSvc) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
||||||
respBody, err := s.exec.SetExtendedACL(ctx, req.GetBody())
|
respBody, err := s.exec.SetExtendedACL(contextWithTokenFromRequest(ctx, req), req.GetBody())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not execute SetEACL request: %w", err)
|
return nil, fmt.Errorf("could not execute SetEACL request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,12 +97,16 @@ func (s *morphExecutor) List(ctx context.Context, body *container.ListRequestBod
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *morphExecutor) SetExtendedACL(ctx context.Context, body *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error) {
|
func (s *morphExecutor) SetExtendedACL(ctx containerSvc.ContextWithToken, body *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error) {
|
||||||
table := eaclSDK.NewTableFromV2(body.GetEACL())
|
table := eaclSDK.NewTableFromV2(body.GetEACL())
|
||||||
sign := pkg.NewSignatureFromV2(body.GetSignature())
|
sign := pkg.NewSignatureFromV2(body.GetSignature())
|
||||||
|
|
||||||
table.SetSignature(sign)
|
table.SetSignature(sign)
|
||||||
|
|
||||||
|
table.SetSessionToken(
|
||||||
|
session.NewTokenFromV2(ctx.SessionToken),
|
||||||
|
)
|
||||||
|
|
||||||
err := wrapper.PutEACL(s.wrapper, table)
|
err := wrapper.PutEACL(s.wrapper, table)
|
||||||
|
|
||||||
return new(container.SetExtendedACLResponseBody), err
|
return new(container.SetExtendedACLResponseBody), err
|
||||||
|
|
Loading…
Reference in a new issue