fix(go): use conn directly for now;

This commit is contained in:
VishalDalwadi
2026-03-24 17:53:30 +05:30
parent 03a4a2a9e9
commit 7507d35b8c
+4 -15
View File
@@ -657,24 +657,15 @@ func UpdateUserGroup(g schema.UserGroup) error {
}
func DeleteAndCleanUpGroup(group *schema.UserGroup) error {
dbctx := db.BeginTx(context.TODO())
commit := false
defer func() {
if commit {
db.FromContext(dbctx).Commit()
} else {
db.FromContext(dbctx).Rollback()
}
}()
users, err := (&schema.User{}).ListAll(dbctx)
// TODO: wrap in transaction once acls are migrated to sql schema.
users, err := (&schema.User{}).ListAll(db.WithContext(context.TODO()))
if err != nil {
return err
}
for _, user := range users {
delete(user.UserGroups.Data(), group.ID)
err = user.Update(dbctx)
err = user.Update(db.WithContext(context.TODO()))
if err != nil {
return err
}
@@ -732,13 +723,11 @@ func DeleteAndCleanUpGroup(group *schema.UserGroup) error {
}
}
err = group.Delete(dbctx)
err = group.Delete(db.WithContext(context.TODO()))
if err != nil {
return err
}
commit = true
go UpdatesUserGwAccessOnGrpUpdates(group.ID, group.NetworkRoles.Data(), make(map[schema.NetworkID]map[schema.UserRoleID]struct{}))
go mq.PublishPeerUpdate(replacePeers)