Skip to content

Commit 7e511cf

Browse files
fix[backend](soar): command line add tenant id on context (#2539)
1 parent d4cab26 commit 7e511cf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

backend/modules/soar/handler/command_ws.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,11 @@ func (h *CommandWSHandler) CommandStream(c *gin.Context) {
195195
return
196196
}
197197
// A fresh context: ctx is cancelled by the time this runs on a
198-
// disconnect, and the row still has to be closed.
199-
done, cancelDone := context.WithTimeout(context.Background(), 5*time.Second)
198+
// disconnect, and the row still has to be closed. The tenancy GORM
199+
// callback needs the acting tenant in the context, so carry it over
200+
// from the actor — a bare context.Background() fails the update with
201+
// ErrNoTenant whenever multi-tenancy is enabled.
202+
done, cancelDone := context.WithTimeout(authz.WithTenantID(context.Background(), actor.TenantID), 5*time.Second)
200203
defer cancelDone()
201204
_ = h.executionUC.FinishManual(done, execID, status, collected.String())
202205
}

0 commit comments

Comments
 (0)