select domain id
This commit is contained in:
parent
39d35857a1
commit
6a350ac9fb
|
@ -24,17 +24,21 @@ func getDomain(ctx context.Context, w http.ResponseWriter) (domain Domain, retur
|
|||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
fmt.Println(id)
|
||||
domain = Domain{ID: id}
|
||||
|
||||
if login.Superadmin {
|
||||
dbconnection.Where(map[string]int64{"ID": id}).Find(&domain)
|
||||
dbconnection.Find(&domain)
|
||||
} else {
|
||||
dbconnection.Where(map[string]int64{"ID": id, "profil": profil.ID}).Find(&domain)
|
||||
dbconnection.Where(map[string]int64{"profil": profil.ID}).Find(&domain)
|
||||
}
|
||||
|
||||
if domain.ID <= 0 {
|
||||
returnerr = &libapi.ErrorResult{Fields: []string{"domain"}, Message: "not found"}
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
if id != domain.ID {
|
||||
fmt.Printf("want %d, get %d", id, domain.ID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -56,7 +60,7 @@ func domainList(ctx context.Context, w http.ResponseWriter, r *http.Request) (re
|
|||
|
||||
func domainShow(ctx context.Context, w http.ResponseWriter, r *http.Request) (returndata interface{}, returnerr *libapi.ErrorResult) {
|
||||
returndata = false
|
||||
logger := log.GetLog(r, "domainlist")
|
||||
logger := log.GetLog(r, "domainshow")
|
||||
domain, returnerr := getDomain(ctx, w)
|
||||
if returnerr != nil {
|
||||
logger.Info("not found")
|
||||
|
|
Reference in New Issue