You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package v1
import ( "fmt" "gin-vue-admin/global/response" "gin-vue-admin/model/request" resp "gin-vue-admin/model/response" "gin-vue-admin/service" "github.com/gin-gonic/gin" )
// @Tags casbin
// @Summary 更改角色api权限
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CasbinInReceive true "更改角色api权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/UpdateCasbin [post]
func UpdateCasbin(c *gin.Context) { var cmr request.CasbinInReceive _ = c.ShouldBindJSON(&cmr) err := service.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos) if err != nil { response.FailWithMessage(fmt.Sprintf("添加规则失败,%v", err), c) } else { response.OkWithMessage("添加规则成功", c) } }
// @Tags casbin
// @Summary 获取权限列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/getPolicyPathByAuthorityId [post]
func GetPolicyPathByAuthorityId(c *gin.Context) { var cmr request.CasbinInReceive _ = c.ShouldBindJSON(&cmr) paths := service.GetPolicyPathByAuthorityId(cmr.AuthorityId) response.OkWithData(resp.PolicyPathResponse{Paths: paths}, c) }
// @Tags casbin
// @Summary casb RBAC RESTFUL测试路由
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/CasbinTest [get]
func CasbinTest(c *gin.Context) { // 测试restful以及占位符代码 随意书写
pathParam := c.Param("pathParam") query := c.Query("query") response.OkDetailed(gin.H{"pathParam": pathParam, "query": query}, "获取规则成功", c) }
|