From 9cfdfbac78c7692206ae55b4e0b35033e7d1ac1e Mon Sep 17 00:00:00 2001 From: hoteas <等> Date: Mon, 18 Jul 2022 19:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code.go | 76 --------------------------------------------------------- 1 file changed, 76 deletions(-) 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) { - - }, - }, }