From aca0158c7f6284676a8a7c4b9dfb6b6c69c2013b Mon Sep 17 00:00:00 2001 From: yangk Date: Wed, 2 Dec 2020 14:54:13 +0800 Subject: [PATCH] record operator name --- api/api_routers/version2/v2Plugin.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/api_routers/version2/v2Plugin.go b/api/api_routers/version2/v2Plugin.go index ede4e9753..f74b626c5 100644 --- a/api/api_routers/version2/v2Plugin.go +++ b/api/api_routers/version2/v2Plugin.go @@ -21,6 +21,7 @@ package version2 import ( "github.com/goodrain/rainbond/api/controller" "github.com/goodrain/rainbond/api/middleware" + dbmodel "github.com/goodrain/rainbond/db/model" "github.com/go-chi/chi" ) @@ -46,13 +47,13 @@ func (v2 *V2) serviceRelatePluginRouter() chi.Router { r := chi.NewRouter() //service relate plugin // v2/tenant/tenant_name/services/service_alias/plugin/xxx - r.Post("/", controller.GetManager().PluginSet) - r.Put("/", controller.GetManager().PluginSet) + r.Post("/", middleware.WrapEL(controller.GetManager().PluginSet, dbmodel.TargetTypeService, "create-service-plugin", dbmodel.SYNEVENTTYPE)) + r.Put("/", middleware.WrapEL(controller.GetManager().PluginSet, dbmodel.TargetTypeService, "update-service-plugin", dbmodel.SYNEVENTTYPE)) r.Get("/", controller.GetManager().PluginSet) - r.Delete("/{plugin_id}", controller.GetManager().DeletePluginRelation) + r.Delete("/{plugin_id}", middleware.WrapEL(controller.GetManager().DeletePluginRelation, dbmodel.TargetTypeService, "delete-service-plugin", dbmodel.SYNEVENTTYPE)) // app plugin config supdate - r.Post("/{plugin_id}/setenv", controller.GetManager().UpdateVersionEnv) - r.Put("/{plugin_id}/upenv", controller.GetManager().UpdateVersionEnv) + r.Post("/{plugin_id}/setenv", middleware.WrapEL(controller.GetManager().UpdateVersionEnv, dbmodel.TargetTypeService, "update-service-plugin-config", dbmodel.SYNEVENTTYPE)) + r.Put("/{plugin_id}/upenv", middleware.WrapEL(controller.GetManager().UpdateVersionEnv, dbmodel.TargetTypeService, "update-service-plugin-config", dbmodel.SYNEVENTTYPE)) //deprecated r.Get("/{plugin_id}/envs", controller.GetManager().GePluginEnvWhichCanBeSet) return r