修复部分bug

This commit is contained in:
hoteas 2022-11-14 16:49:37 +08:00
parent 5b407824a5
commit be41a70c76

35
code.go
View File

@ -875,11 +875,12 @@ var TptProject = Proj{
} }
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))}) linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))})
linkAuth := linkAuthMap.GetMap("auth") oldLinkAuth := linkAuthMap.GetMap("auth")
linkAuth := Map{}
//conf := ObjToMap(string(btes)) //conf := ObjToMap(string(btes))
//menus := conf.GetSlice("menus") //menus := conf.GetSlice("menus")
if linkAuth == nil { if oldLinkAuth != nil {
linkAuth = Map{} linkAuth = oldLinkAuth
} }
for k1, _ := range menus { for k1, _ := range menus {
@ -890,7 +891,7 @@ var TptProject = Proj{
} }
if v1["auth"] != nil { if v1["auth"] != nil {
if linkAuth[name] == nil { if oldLinkAuth == nil {
linkAuth[name] = v1["auth"] linkAuth[name] = v1["auth"]
} else { } else {
newAuth := Slice{} newAuth := Slice{}
@ -913,7 +914,7 @@ var TptProject = Proj{
} }
if v2["auth"] != nil { if v2["auth"] != nil {
if linkAuth[name] == nil { if oldLinkAuth == nil {
linkAuth[name] = v2["auth"] linkAuth[name] = v2["auth"]
} else { } else {
@ -935,32 +936,36 @@ var TptProject = Proj{
for k1, _ := range menus { for k1, _ := range menus {
v1 := menus.GetMap(k1) v1 := menus.GetMap(k1)
//保证个人权限可用
if fileConfig.GetString("table") == v1.GetString("table") {
v1["auth"] = Slice{"info", "edit"}
}
name := v1.GetString("name") name := v1.GetString("name")
if name == "" { if name == "" {
name = v1.GetString("table") name = v1.GetString("table")
} }
if linkAuth[name] != nil { if len(linkAuth.GetSlice(name)) != 0 {
v1["auth"] = linkAuth[name]
} else
//保证个人权限可用
if fileConfig.GetString("table") == v1.GetString("table") {
v1["auth"] = Slice{"info", "edit"}
} else {
v1["auth"] = linkAuth[name] v1["auth"] = linkAuth[name]
} }
v1menus := v1.GetSlice("menus") v1menus := v1.GetSlice("menus")
for k2, _ := range v1menus { for k2, _ := range v1menus {
v2 := v1menus.GetMap(k2) v2 := v1menus.GetMap(k2)
//保证个人权限可用 //保证个人权限可用
if fileConfig.GetString("table") == v2.GetString("table") {
v2["auth"] = Slice{"info", "edit"}
}
name := v2.GetString("name") name := v2.GetString("name")
if name == "" { if name == "" {
name = v2.GetString("table") name = v2.GetString("table")
} }
if linkAuth[name] != nil { if len(linkAuth.GetSlice(name)) != 0 {
v2["auth"] = linkAuth[name]
} else if fileConfig.GetString("table") == v2.GetString("table") {
v2["auth"] = Slice{"info", "edit"}
} else {
v2["auth"] = linkAuth[name] v2["auth"] = linkAuth[name]
} }