[v9.0.x] Plugins: Register management endpoints only when external managed is also false (#51817)

* Plugins: Register management endpoints only when external managed is also false (#51802)

* Only define plugin install endpoints when catalog enabled

* add external check

(cherry picked from commit 40dff288cd)

* fix test

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-07-07 11:19:32 +02:00
committed by GitHub
co-authored by Will Browne Will Browne
parent 65f31f978c
commit 11c15f3bfa
4 changed files with 109 additions and 9 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ func (hs *HTTPServer) registerRoutes() {
apiRoute.Any("/plugins/:pluginId/resources/*", hs.CallResource)
apiRoute.Get("/plugins/errors", routing.Wrap(hs.GetPluginErrorsList))
if hs.Cfg.PluginAdminEnabled {
if hs.Cfg.PluginAdminEnabled && !hs.Cfg.PluginAdminExternalManageEnabled {
apiRoute.Group("/plugins", func(pluginRoute routing.RouteRegister) {
pluginRoute.Post("/:pluginId/install", routing.Wrap(hs.InstallPlugin))
pluginRoute.Post("/:pluginId/uninstall", routing.Wrap(hs.UninstallPlugin))