diff --git a/pkg/services/object/acl/v2/request.go b/pkg/services/object/acl/v2/request.go index c58c00e0e..119c19af3 100644 --- a/pkg/services/object/acl/v2/request.go +++ b/pkg/services/object/acl/v2/request.go @@ -5,6 +5,7 @@ import ( "fmt" sessionV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -150,3 +151,11 @@ func unmarshalPublicKeyWithOwner(rawKey []byte) (*user.ID, *keys.PublicKey, erro return &idSender, key, nil } + +func (r RequestInfo) toRequestContext() *object.RequestContext { + return &object.RequestContext{ + Namespace: r.ContainerNamespace(), + SenderKey: r.SenderKey(), + Role: r.RequestRole(), + } +} diff --git a/pkg/services/object/acl/v2/service.go b/pkg/services/object/acl/v2/service.go index add2830f4..22ccacd47 100644 --- a/pkg/services/object/acl/v2/service.go +++ b/pkg/services/object/acl/v2/service.go @@ -118,11 +118,7 @@ func (w *wrappedGetObjectStream) Context() context.Context { func newWrappedGetObjectStreamStream(getObjectStream object.GetObjectStream, reqInfo RequestInfo) object.GetObjectStream { return &wrappedGetObjectStream{ GetObjectStream: getObjectStream, - requestContext: &object.RequestContext{ - Namespace: reqInfo.ContainerNamespace(), - SenderKey: reqInfo.SenderKey(), - Role: reqInfo.RequestRole(), - }, + requestContext: reqInfo.toRequestContext(), } } @@ -141,11 +137,7 @@ func (w *wrappedRangeStream) Context() context.Context { func newWrappedRangeStream(rangeStream object.GetObjectRangeStream, reqInfo RequestInfo) object.GetObjectRangeStream { return &wrappedRangeStream{ GetObjectRangeStream: rangeStream, - requestContext: &object.RequestContext{ - Namespace: reqInfo.ContainerNamespace(), - SenderKey: reqInfo.SenderKey(), - Role: reqInfo.RequestRole(), - }, + requestContext: reqInfo.toRequestContext(), } } @@ -163,12 +155,8 @@ func (w *wrappedSearchStream) Context() context.Context { func newWrappedSearchStream(searchStream object.SearchStream, reqInfo RequestInfo) object.SearchStream { return &wrappedSearchStream{ - SearchStream: searchStream, - requestContext: &object.RequestContext{ - Namespace: reqInfo.ContainerNamespace(), - SenderKey: reqInfo.SenderKey(), - Role: reqInfo.RequestRole(), - }, + SearchStream: searchStream, + requestContext: reqInfo.toRequestContext(), } } @@ -457,11 +445,7 @@ func (b Service) GetRange(request *objectV2.GetRangeRequest, stream object.GetOb } func requestContext(ctx context.Context, reqInfo RequestInfo) context.Context { - return object.NewRequestContext(ctx, &object.RequestContext{ - Namespace: reqInfo.ContainerNamespace(), - SenderKey: reqInfo.SenderKey(), - Role: reqInfo.RequestRole(), - }) + return object.NewRequestContext(ctx, reqInfo.toRequestContext()) } func (b Service) GetRangeHash(