拆分数据权限验证,让用户选择是否加

This commit is contained in:
linwenxiang committed 2020-09-03 19:52:15 +08:00
1 parent 3a9831fc8c
commit 560e650070
7 files changed
+60 -25

No files matched your search

+4 -5
View File
@@ -33,11 +33,10 @@ func IndexAction(m model.ActiveRecord, d dto.Index, f func() interface{}) gin.Ha
tools.HasError(err, "参数验证失败", 422)
err = req.Bind(c)
tools.HasError(err, "参数验证失败", 422)
var p = new(dataPermission)
if userId := tools.GetUserIdStr(c); userId != "" {
p, err = newDataPermission(db, userId)
tools.HasError(err, "权限范围鉴定错误", 500)
}
//数据权限检查
p := getPermissionFromContext(c)
err = db.WithContext(c).Model(object).
Scopes(
tools.MakeCondition(req.GetNeedSearch()),