123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package v1
- import (
- "fmt"
- "gin-vue-admin/global/response"
- "gin-vue-admin/model"
- "github.com/gin-gonic/gin"
- )
- func UpdateCasbin(c *gin.Context) {
- var cmr model.CasbinInReceive
- _ = c.ShouldBindJSON(&cmr)
- err := new(model.CasbinModel).UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos)
- if err != nil {
- response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加规则失败,%v", err), c)
- } else {
- response.Result(response.SUCCESS, gin.H{}, "添加规则成功", c)
- }
- }
- func GetPolicyPathByAuthorityId(c *gin.Context) {
- var cmr model.CasbinInReceive
- _ = c.ShouldBindJSON(&cmr)
- paths := new(model.CasbinModel).GetPolicyPathByAuthorityId(cmr.AuthorityId)
- response.Result(response.SUCCESS, gin.H{"paths": paths}, "获取规则成功", c)
- }
- func CasbinTest(c *gin.Context) {
-
- pathParam := c.Param("pathParam")
- query := c.Query("query")
- response.Result(response.SUCCESS, gin.H{"pathParam": pathParam, "query": query}, "获取规则成功", c)
- }
|