fix: enforce platform role menu access
This commit is contained in:
@@ -18,6 +18,7 @@ func RegisterPlatform(serviceKey string, engine *gin.Engine) {
|
||||
|
||||
protected := engine.Group(basePath)
|
||||
protected.Use(middleware.JwtAuth(true))
|
||||
protected.Use(platform.RequirePlatformMenuAccess())
|
||||
protected.GET("/auth/profile", platform.CurrentProfile)
|
||||
protected.PUT("/auth/password", platform.ChangePassword)
|
||||
protected.GET("/dashboard/overview", platform.DashboardOverview)
|
||||
@@ -103,6 +104,8 @@ func registerPlatformRoute(group *gin.RouterGroup) {
|
||||
role.PUT("/:identity", platform.UpdatePlatformRole)
|
||||
role.PATCH("/:identity/status", platform.UpdatePlatformRoleStatus)
|
||||
role.DELETE("/:identity", platform.ArchivePlatformRole)
|
||||
role.GET("/:identity/menu", platform.ListPlatformRoleMenuIdentities)
|
||||
role.PUT("/:identity/menu", platform.ReplacePlatformRoleMenus)
|
||||
role.PUT("/:identity/menus", platform.ReplacePlatformRoleMenus)
|
||||
registerWritableResource(group, "/platform/platform_menu", platform.ListPlatformMenu, platform.CreatePlatformMenu, platform.GetPlatformMenu, platform.UpdatePlatformMenu, &models.PlatformMenu{})
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ func TestPlatformOrganizationAndAccountRoutesExposeResourceCRUD(t *testing.T) {
|
||||
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource+"/:identity/status", http.MethodPatch)
|
||||
}
|
||||
|
||||
assertRouteMethods(t, routes, "/heqi/platform/v1/platform/platform_role/:identity/menu", http.MethodGet, http.MethodPut)
|
||||
assertRouteMethods(t, routes, "/heqi/platform/v1/platform/platform_role/:identity/menus", http.MethodPut)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user