package router import ( "academy/internal/handler/orgcenter" "github.com/gin-gonic/gin" ) // RegisterOrgRoutes registers the org-center routes (/api/v1/org/*). // // 组织中心为租户级共享组织架构(部门/员工档案/模块角色绑定): // - 空间 RBAC 把关:读 Viewer+,写 Contributor+; // - 业务模块语义(职称角色等)由各模块自己的接口细控,本组不感知; // - 不对 API Key 开放(组织数据面向登录用户,默认拒绝)。 func RegisterOrgRoutes(r *gin.RouterGroup, h *orgcenter.Handler, g *rbacGuards) { if h == nil { return } orgGroup := r.Group("/org", g.Viewer()) { // ---- 部门 ---- orgGroup.GET("/depts", h.ListDepts) orgGroup.POST("/depts", g.Contributor(), h.SaveDept) orgGroup.DELETE("/depts/:id", g.Contributor(), h.DeleteDept) // ---- 员工档案 ---- orgGroup.GET("/employees", h.ListEmployees) orgGroup.PUT("/employees/:id", g.Contributor(), h.UpdateEmployee) orgGroup.GET("/platform-users", g.Contributor(), h.ListPlatformUsers) orgGroup.POST("/employees/import", g.Contributor(), h.ImportEmployees) // ---- 模块角色绑定 ---- orgGroup.GET("/modules/:module_key/members", h.ListModuleMembers) orgGroup.PUT("/modules/:module_key/members/:employee_id", g.Contributor(), h.PutModuleMember) } }