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

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

+2 -5
View File
@@ -34,11 +34,8 @@ func UpdateAction(control dto.Control) gin.HandlerFunc {
object.SetUpdateBy(tools.GetUserIdStr(c))
//数据权限检查
var p = new(dataPermission)
if userId := tools.GetUserIdStr(c); userId != "" {
p, err = newDataPermission(db, userId)
tools.HasError(err, "权限范围鉴定错误", 500)
}
p := getPermissionFromContext(c)
db = db.WithContext(c).Scopes(
Permission(object.TableName(), p),
).Updates(object)