sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0

map id on select

This commit is contained in:
Martin Geno 2016-12-13 11:59:19 +01:00
parent 1505a99044
commit 50fb96c200
3 changed files with 4 additions and 4 deletions

View File

@ -24,9 +24,9 @@ func getDomain(ctx context.Context, w http.ResponseWriter) (domain Domain, retur
return return
} }
if login.Superadmin { if login.Superadmin {
dbconnection.Where("id = ?", id).Find(&domain) dbconnection.Where(map[string]int64{"ID": id}).Find(&domain)
} else { } 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 { if domain.ID <= 0 {

View File

@ -24,7 +24,7 @@ func getMail(ctx context.Context, w http.ResponseWriter) (mail Mail, returnerr *
return return
} }
if login.Superadmin { if login.Superadmin {
dbconnection.Where("id = ?", id).Preload("Forwards").Find(&mail) dbconnection.Where(map[string]int64{"ID": id}).Preload("Forwards").Find(&mail)
} else { } else {
dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("Forwards").Find(&mail) dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("Forwards").Find(&mail)
} }

View File

@ -37,7 +37,7 @@ func getWeb(ctx context.Context, w http.ResponseWriter) (web Web, returnerr *lib
return return
} }
if login.Superadmin { 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 { } else {
dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("HTTPAccess.Login").Preload("FTPAccess.Login").Find(&web) dbconnection.Where(map[string]int64{"ID": id, "domain.profil": profil.ID}).Preload("HTTPAccess.Login").Preload("FTPAccess.Login").Find(&web)
} }