管理员查询WAF策略时隐藏用户创建的

This commit is contained in:
GoEdgeLab
2021-01-05 14:11:00 +08:00
parent b3cfb7803b
commit 87828af844
4 changed files with 5 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
package teaconst package teaconst
const ( const (
Version = "0.0.7" Version = "0.0.7.1"
ProductName = "Edge API" ProductName = "Edge API"
ProcessName = "edge-api" ProcessName = "edge-api"

View File

@@ -184,6 +184,7 @@ func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicy(tx *dbs.Tx, policyId int
func (this *HTTPFirewallPolicyDAO) CountAllEnabledFirewallPolicies(tx *dbs.Tx) (int64, error) { func (this *HTTPFirewallPolicyDAO) CountAllEnabledFirewallPolicies(tx *dbs.Tx) (int64, error) {
return this.Query(tx). return this.Query(tx).
State(HTTPFirewallPolicyStateEnabled). State(HTTPFirewallPolicyStateEnabled).
Attr("userId", 0).
Count() Count()
} }
@@ -191,6 +192,7 @@ func (this *HTTPFirewallPolicyDAO) CountAllEnabledFirewallPolicies(tx *dbs.Tx) (
func (this *HTTPFirewallPolicyDAO) ListEnabledFirewallPolicies(tx *dbs.Tx, offset int64, size int64) (result []*HTTPFirewallPolicy, err error) { func (this *HTTPFirewallPolicyDAO) ListEnabledFirewallPolicies(tx *dbs.Tx, offset int64, size int64) (result []*HTTPFirewallPolicy, err error) {
_, err = this.Query(tx). _, err = this.Query(tx).
State(HTTPFirewallPolicyStateEnabled). State(HTTPFirewallPolicyStateEnabled).
Attr("userId", 0).
Offset(offset). Offset(offset).
Limit(size). Limit(size).
DescPk(). DescPk().

View File

@@ -19,7 +19,7 @@ func IsNotNull(data string) bool {
func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query { func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query {
query := dao.Object().Query(tx) query := dao.Object().Query(tx)
if adminId > 0 { if adminId > 0 {
query.Attr("adminId", adminId) //query.Attr("adminId", adminId)
} }
if userId > 0 { if userId > 0 {
query.Attr("userId", userId) query.Attr("userId", userId)

File diff suppressed because one or more lines are too long