12345678910111213141516171819202122232425262728 |
- package routers
- import (
- "Cold_GoodsOrder/Nats/NatsServer"
- "Cold_GoodsOrder/lib"
- "Cold_GoodsOrder/models/Account"
- "github.com/beego/beego/v2/server/web/context"
- )
- func RBACFilter(ctx *context.Context) {
- b_, User_r, T_pid := NatsServer.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 := NatsServer.CheckUserPermissions(Account.User_r.T_power, ctx.Request.URL.Path)
- if !flag {
- data := lib.JSONS{Code: 202, Msg: "无权访问!"}
- ctx.Output.JSON(data, true, false)
- return
- }
- }
|