forked from TrueCloudLab/frostfs-node
[#525] v2/container: Write session token from header to removal witness
If container is removed via session, then session token should be included in removal witness. Write session token from request meta header to `container.RemovalWitness` structure which is passed to `wrapper.Delete` function. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
40c796bd7e
commit
a1bfcdc74a
2 changed files with 5 additions and 3 deletions
|
@ -51,14 +51,16 @@ func (s *morphExecutor) Put(ctx containerSvc.ContextWithToken, body *container.P
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func (s *morphExecutor) Delete(ctx context.Context, body *container.DeleteRequestBody) (*container.DeleteResponseBody, error) {
|
||||
func (s *morphExecutor) Delete(ctx containerSvc.ContextWithToken, body *container.DeleteRequestBody) (*container.DeleteResponseBody, error) {
|
||||
cid := containerSDK.NewIDFromV2(body.GetContainerID())
|
||||
sig := body.GetSignature().GetSign()
|
||||
tok := session.NewTokenFromV2(ctx.SessionToken)
|
||||
|
||||
var rmWitness containercore.RemovalWitness
|
||||
|
||||
rmWitness.SetContainerID(cid)
|
||||
rmWitness.SetSignature(sig)
|
||||
rmWitness.SetSessionToken(tok)
|
||||
|
||||
err := wrapper.Delete(s.wrapper, rmWitness)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue