From 72ec59bdac482d1696c448d87eeb1f9f2562c795 Mon Sep 17 00:00:00 2001 From: 710leo <710leo@gmail.com> Date: Wed, 13 Jan 2021 14:04:56 +0800 Subject: [PATCH] Support unassigned tenant search --- src/models/host.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/host.go b/src/models/host.go index 39ceabb8..1965e7c4 100644 --- a/src/models/host.go +++ b/src/models/host.go @@ -148,7 +148,9 @@ func HostGetsForAdmin(tenant, query, batch, field string, limit, offset int) ([] func buildHostWhere(tenant, query, batch, field string) *xorm.Session { session := DB["ams"].Table(new(Host)).OrderBy("ident") - if tenant != "" { + if tenant == "0" { + session = session.Where("tenant=?", "") + } else if tenant != "" { session = session.Where("tenant=?", tenant) } -- GitLab