forked from opsre/go-ldap-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
role_routes.go
29 lines (25 loc) · 868 Bytes
/
role_routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package routes
import (
"github.com/eryajf/go-ldap-admin/controller"
"github.com/eryajf/go-ldap-admin/middleware"
jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
)
func InitRoleRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gin.IRoutes {
role := r.Group("/role")
// 开启jwt认证中间件
role.Use(authMiddleware.MiddlewareFunc())
// 开启casbin鉴权中间件
role.Use(middleware.CasbinMiddleware())
{
role.GET("/list", controller.Role.List)
role.POST("/add", controller.Role.Add)
role.POST("/update", controller.Role.Update)
role.POST("/delete", controller.Role.Delete)
role.GET("/getmenulist", controller.Role.GetMenuList)
role.GET("/getapilist", controller.Role.GetApiList)
role.POST("/updatemenus", controller.Role.UpdateMenus)
role.POST("/updateapis", controller.Role.UpdateApis)
}
return r
}