增加角色权限

pull/30/head
taoshihan1991 4 years ago
parent 5655facbaa
commit b4b70e2972

@ -1,4 +1,4 @@
p, admin, /mysql, GET
p, admin, /mysql, POST
p, admin, /kefuinfo,POST
p, admin, /kefuinfo,DELETE
p, role_1, /mysql, GET
p, role_1, /mysql, POST
p, role_1, /kefuinfo,POST
p, role_1, /kefuinfo,DELETE
1 p admin role_1 /mysql GET
2 p admin role_1 /mysql POST
3 p admin role_1 /kefuinfo POST
4 p admin role_1 /kefuinfo DELETE

@ -7,7 +7,8 @@ import (
"log"
)
func CasbinACL(c *gin.Context){
sub, _ :=c.Get("user")
roleId, _ :=c.Get("role_id")
sub:=fmt.Sprintf("%s_%d","role",int(roleId.(float64)))
obj:=c.Request.RequestURI
act:=c.Request.Method
e, err := casbin.NewEnforcer("config/model.conf", "config/policy.csv")

Loading…
Cancel
Save