mirror of
https://github.com/jsiebens/ionscale.git
synced 2026-03-31 15:07:49 +01:00
chore: omit associations by default
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/jsiebens/ionscale/internal/util"
|
"github.com/jsiebens/ionscale/internal/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
@@ -98,7 +99,7 @@ type repository struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *repository) withContext(ctx context.Context) *gorm.DB {
|
func (r *repository) withContext(ctx context.Context) *gorm.DB {
|
||||||
return r.db.WithContext(ctx)
|
return r.db.WithContext(ctx).Omit(clause.Associations)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repository) Transaction(action func(Repository) error) error {
|
func (r *repository) Transaction(action func(Repository) error) error {
|
||||||
|
|||||||
@@ -479,8 +479,10 @@ func (h *AuthenticationHandlers) endMachineRegistrationFlow(c echo.Context, form
|
|||||||
KeyExpiryDisabled: len(tags) != 0,
|
KeyExpiryDisabled: len(tags) != 0,
|
||||||
Authorized: !tailnet.MachineAuthorizationEnabled || authorized,
|
Authorized: !tailnet.MachineAuthorizationEnabled || authorized,
|
||||||
|
|
||||||
User: *user,
|
User: *user,
|
||||||
Tailnet: *tailnet,
|
UserID: user.ID,
|
||||||
|
Tailnet: *tailnet,
|
||||||
|
TailnetID: tailnet.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
ipv4, ipv6, err := addr.SelectIP(checkIP(ctx, h.repository.CountMachinesWithIPv4))
|
ipv4, ipv6, err := addr.SelectIP(checkIP(ctx, h.repository.CountMachinesWithIPv4))
|
||||||
|
|||||||
@@ -202,8 +202,10 @@ func (h *RegistrationHandlers) authenticateMachineWithAuthKey(c echo.Context, ma
|
|||||||
KeyExpiryDisabled: len(tags) != 0,
|
KeyExpiryDisabled: len(tags) != 0,
|
||||||
Authorized: !tailnet.MachineAuthorizationEnabled || authKey.PreAuthorized,
|
Authorized: !tailnet.MachineAuthorizationEnabled || authKey.PreAuthorized,
|
||||||
|
|
||||||
User: user,
|
User: user,
|
||||||
Tailnet: tailnet,
|
UserID: user.ID,
|
||||||
|
Tailnet: tailnet,
|
||||||
|
TailnetID: tailnet.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !req.Expiry.IsZero() {
|
if !req.Expiry.IsZero() {
|
||||||
|
|||||||
Reference in New Issue
Block a user