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"
|
||||
"github.com/jsiebens/ionscale/internal/util"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"net/http"
|
||||
"sync"
|
||||
"tailscale.com/tailcfg"
|
||||
@@ -98,7 +99,7 @@ type repository struct {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -479,8 +479,10 @@ func (h *AuthenticationHandlers) endMachineRegistrationFlow(c echo.Context, form
|
||||
KeyExpiryDisabled: len(tags) != 0,
|
||||
Authorized: !tailnet.MachineAuthorizationEnabled || authorized,
|
||||
|
||||
User: *user,
|
||||
Tailnet: *tailnet,
|
||||
User: *user,
|
||||
UserID: user.ID,
|
||||
Tailnet: *tailnet,
|
||||
TailnetID: tailnet.ID,
|
||||
}
|
||||
|
||||
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,
|
||||
Authorized: !tailnet.MachineAuthorizationEnabled || authKey.PreAuthorized,
|
||||
|
||||
User: user,
|
||||
Tailnet: tailnet,
|
||||
User: user,
|
||||
UserID: user.ID,
|
||||
Tailnet: tailnet,
|
||||
TailnetID: tailnet.ID,
|
||||
}
|
||||
|
||||
if !req.Expiry.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user