diff --git a/code.go b/code.go index b9246f9..1c5f756 100644 --- a/code.go +++ b/code.go @@ -550,80 +550,4 @@ var TptProject = Proj{ that.Display(0, config) }, }, - "auth": { - //权限操作 - "info": func(that *Context) { - //不存在配置文件则生成,存在则不管 - hotimeName := that.RouterString[0] - fileConfig := that.MakeCodeRouter[hotimeName].FileConfig - btes, err := ioutil.ReadFile(fileConfig.GetString("config")) - - if err != nil { - that.Display(4, "找不到配置文件") - } - - conf := ObjToMap(string(btes)) - menus := conf.GetSlice("menus") - - user := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": fileConfig.GetString("table") + "_id"}) - - if user == nil { - that.Display(2, "暂未登录") - return - } - - for _, v := range that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")] { - if v.GetString("link") != "" { - linkHasAuth := that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("link")]["auth"] - if linkHasAuth == nil { - continue - } - - linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))}) - linkAuth := linkAuthMap.GetMap("auth") - - for k1, _ := range menus { - v1 := menus.GetMap(k1) - if linkAuth[v1.GetString("name")] != nil { - v1["auth"] = linkAuth[v1.GetString("name")] - } - - for k2, _ := range v1.GetSlice("menus") { - v2 := menus.GetMap(k2) - if linkAuth[v2.GetString("name")] != nil { - v2["auth"] = linkAuth[v2.GetString("name")] - } - } - } - - } - } - - userAuth := user.GetMap("auth") - for k1, _ := range menus { - v1 := menus.GetMap(k1) - if userAuth[v1.GetString("name")] != nil { - v1["auth"] = userAuth[v1.GetString("name")] - } - - for k2, _ := range v1.GetSlice("menus") { - v2 := menus.GetMap(k2) - if userAuth[v2.GetString("name")] != nil { - v2["auth"] = userAuth[v2.GetString("name")] - } - } - } - - that.Display(0, menus) - - }, - //权限操作 - "reset": func(that *Context) { - - }, - //权限操作 - "update": func(that *Context) { - - }, - }, }