mirror of
https://github.com/openziti/zrok.git
synced 2025-01-22 05:48:46 +01:00
fixed a lingering and silly bug causing FK constraint issues
This commit is contained in:
parent
9cbbb40105
commit
0142834665
@ -38,11 +38,13 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
envId := params.Body.ZitiIdentityID
|
||||
envIdDb := 0
|
||||
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
|
||||
found := false
|
||||
for _, env := range envs {
|
||||
if env.ZitiIdentityId == envId {
|
||||
logrus.Infof("found identity '%v' for user '%v'", envId, principal.Email)
|
||||
envIdDb = env.Id
|
||||
found = true
|
||||
break
|
||||
}
|
||||
@ -91,7 +93,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
|
||||
|
||||
logrus.Infof("allocated service '%v'", svcName)
|
||||
|
||||
sid, err := str.CreateService(int(principal.ID), &store.Service{
|
||||
sid, err := str.CreateService(envIdDb, &store.Service{
|
||||
ZitiServiceId: svcId,
|
||||
Endpoint: params.Body.Endpoint,
|
||||
}, tx)
|
||||
|
Loading…
Reference in New Issue
Block a user