ldap-1-backend/routes/group_routes.go

37 lines
1.3 KiB
Go
Raw Normal View History

2022-05-18 17:57:03 +08:00
package routes
import (
2022-05-29 10:06:21 +08:00
"github.com/eryajf/go-ldap-admin/controller"
"github.com/eryajf/go-ldap-admin/middleware"
2022-05-18 17:57:03 +08:00
jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
)
func InitGroupRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gin.IRoutes {
group := r.Group("/group")
// 开启jwt认证中间件
group.Use(authMiddleware.MiddlewareFunc())
// 开启casbin鉴权中间件
group.Use(middleware.CasbinMiddleware())
{
group.GET("/list", controller.Group.List)
group.GET("/tree", controller.Group.GetTree)
2022-05-18 17:57:03 +08:00
group.POST("/add", controller.Group.Add)
group.POST("/update", controller.Group.Update)
group.POST("/delete", controller.Group.Delete)
group.POST("/adduser", controller.Group.AddUser)
group.POST("/removeuser", controller.Group.RemoveUser)
group.GET("/useringroup", controller.Group.UserInGroup)
group.GET("/usernoingroup", controller.Group.UserNoInGroup)
group.POST("/syncDingTalkDepts", controller.Group.SyncDingTalkDepts) // 同步部门
group.POST("/syncWeComDepts", controller.Group.SyncWeComDepts) // 同步部门
2022-06-21 20:50:38 +08:00
group.POST("/syncFeiShuDepts", controller.Group.SyncFeiShuDepts) // 同步部门
group.POST("/syncOpenLdapDepts", controller.Group.SyncOpenLdapDepts) // 同步部门
2022-05-18 17:57:03 +08:00
}
return r
}