From 50fb96c200f918506a946c021031516f74a18086 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Tue, 13 Dec 2016 11:59:19 +0100 Subject: [PATCH] map id on select --- modul/host/apidomain.go | 4 ++-- modul/host/apimail.go | 2 +- modul/host/apiweb.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modul/host/apidomain.go b/modul/host/apidomain.go index 83c2b0d..ba6c877 100644 --- a/modul/host/apidomain.go +++ b/modul/host/apidomain.go @@ -24,9 +24,9 @@ func getDomain(ctx context.Context, w http.ResponseWriter) (domain Domain, retur return } if login.Superadmin { - dbconnection.Where("id = ?", id).Find(&domain) + dbconnection.Where(map[string]int64{"ID": id}).Find(&domain) } else { - dbconnection.Where(map[string]int64{"id": id, "profil": profil.ID}).Find(&domain) + dbconnection.Where(map[string]int64{"ID": id, "profil": profil.ID}).Find(&domain) } if domain.ID <= 0 { diff --git a/modul/host/apimail.go b/modul/host/apimail.go index f30cee7..41c507f 100644 --- a/modul/host/apimail.go +++ b/modul/host/apimail.go @@ -24,7 +24,7 @@ func getMail(ctx context.Context, w http.ResponseWriter) (mail Mail, returnerr * return } if login.Superadmin { - dbconnection.Where("id = ?", id).Preload("Forwards").Find(&mail) + dbconnection.Where(map[string]int64{"ID": id}).Preload("Forwards").Find(&mail) } else { dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("Forwards").Find(&mail) } diff --git a/modul/host/apiweb.go b/modul/host/apiweb.go index 81c3387..75dab31 100644 --- a/modul/host/apiweb.go +++ b/modul/host/apiweb.go @@ -37,7 +37,7 @@ func getWeb(ctx context.Context, w http.ResponseWriter) (web Web, returnerr *lib return } if login.Superadmin { - dbconnection.Where("id = ?", id).Preload("HTTPAccess.Login").Preload("FTPAccess.Login").Find(&web) + dbconnection.Where(map[string]int64{"ID": id}).Preload("HTTPAccess.Login").Preload("FTPAccess.Login").Find(&web) } else { dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("HTTPAccess.Login").Preload("FTPAccess.Login").Find(&web) }