mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 17:58:50 +02: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() }()
|
defer func() { _ = tx.Rollback() }()
|
||||||
|
|
||||||
envId := params.Body.ZitiIdentityID
|
envId := params.Body.ZitiIdentityID
|
||||||
|
envIdDb := 0
|
||||||
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
|
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
|
||||||
found := false
|
found := false
|
||||||
for _, env := range envs {
|
for _, env := range envs {
|
||||||
if env.ZitiIdentityId == envId {
|
if env.ZitiIdentityId == envId {
|
||||||
logrus.Infof("found identity '%v' for user '%v'", envId, principal.Email)
|
logrus.Infof("found identity '%v' for user '%v'", envId, principal.Email)
|
||||||
|
envIdDb = env.Id
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -91,7 +93,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
|
|||||||
|
|
||||||
logrus.Infof("allocated service '%v'", svcName)
|
logrus.Infof("allocated service '%v'", svcName)
|
||||||
|
|
||||||
sid, err := str.CreateService(int(principal.ID), &store.Service{
|
sid, err := str.CreateService(envIdDb, &store.Service{
|
||||||
ZitiServiceId: svcId,
|
ZitiServiceId: svcId,
|
||||||
Endpoint: params.Body.Endpoint,
|
Endpoint: params.Body.Endpoint,
|
||||||
}, tx)
|
}, tx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user