package routers import ( "Cold_WorkOrder/Nats" "Cold_WorkOrder/lib" "Cold_WorkOrder/models/Account" "github.com/beego/beego/v2/server/web/context" ) func FilterRBAC(ctx *context.Context) { b_, User_r, T_pid := Nats.Verification(ctx.GetCookie("User_tokey"), ctx.Input.Query("User_tokey")) if !b_ { ctx.Output.JSON(lib.JSONS{Code: 201, Msg: "请重新登陆!"}, true, false) return } Account.User_r = &User_r Account.T_pid = &T_pid flag := Nats.CheckUserPermissions(User_r.T_power, ctx.Request.URL.Path) if !flag { data := lib.JSONS{Code: 202, Msg: "无权访问!"} ctx.Output.JSON(data, true, false) return } }