[MM-26507] Send license type for install plugin request (#14913)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a34ea6ad63
Коммит
43f7acd45a
@@ -497,7 +497,9 @@ func (a *App) getRemoteMarketplacePlugin(pluginId, version string) (*model.BaseM
|
||||
return nil, model.NewAppError("GetMarketplacePlugin", "app.plugin.marketplace_client.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
filter := &model.MarketplacePluginFilter{Filter: pluginId, ServerVersion: model.CurrentVersion}
|
||||
filter := a.getBaseMarketplaceFilter()
|
||||
filter.Filter = pluginId
|
||||
|
||||
plugin, err := marketplaceClient.GetPlugin(filter, version)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetMarketplacePlugin", "app.plugin.marketplace_plugins.not_found.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
@@ -522,20 +524,9 @@ func (a *App) getRemotePlugins() (map[string]*model.MarketplacePlugin, *model.Ap
|
||||
return nil, model.NewAppError("getRemotePlugins", "app.plugin.marketplace_client.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
filter := a.getBaseMarketplaceFilter()
|
||||
// Fetch all plugins from marketplace.
|
||||
filter := &model.MarketplacePluginFilter{
|
||||
PerPage: -1,
|
||||
ServerVersion: model.CurrentVersion,
|
||||
}
|
||||
|
||||
license := a.Srv().License()
|
||||
if license != nil && *license.Features.EnterprisePlugins {
|
||||
filter.EnterprisePlugins = true
|
||||
}
|
||||
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
filter.BuildEnterpriseReady = true
|
||||
}
|
||||
filter.PerPage = -1
|
||||
|
||||
marketplacePlugins, err := marketplaceClient.GetPlugins(filter)
|
||||
if err != nil {
|
||||
@@ -655,6 +646,23 @@ func (a *App) mergeLocalPlugins(remoteMarketplacePlugins map[string]*model.Marke
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) getBaseMarketplaceFilter() *model.MarketplacePluginFilter {
|
||||
filter := &model.MarketplacePluginFilter{
|
||||
ServerVersion: model.CurrentVersion,
|
||||
}
|
||||
|
||||
license := a.Srv().License()
|
||||
if license != nil && *license.Features.EnterprisePlugins {
|
||||
filter.EnterprisePlugins = true
|
||||
}
|
||||
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
filter.BuildEnterpriseReady = true
|
||||
}
|
||||
|
||||
return filter
|
||||
}
|
||||
|
||||
func pluginMatchesFilter(manifest *model.Manifest, filter string) bool {
|
||||
filter = strings.TrimSpace(strings.ToLower(filter))
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user