[MM-37494] Check for license SKU when preparing marketplace requests (#18031)
* check for license SKU when preparing marketplace requests * rename method to HasEnterpriseMarketplacePlugins Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6031b163d8
Коммит
eaa37b52ee
@@ -720,7 +720,7 @@ func (s *Server) getBaseMarketplaceFilter() *model.MarketplacePluginFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
license := s.License()
|
license := s.License()
|
||||||
if license != nil && *license.Features.EnterprisePlugins {
|
if license != nil && license.HasEnterpriseMarketplacePlugins() {
|
||||||
filter.EnterprisePlugins = true
|
filter.EnterprisePlugins = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ const (
|
|||||||
InvalidLicenseError = "api.license.add_license.invalid.app_error"
|
InvalidLicenseError = "api.license.add_license.invalid.app_error"
|
||||||
LicenseGracePeriod = 1000 * 60 * 60 * 24 * 10 //10 days
|
LicenseGracePeriod = 1000 * 60 * 60 * 24 * 10 //10 days
|
||||||
LicenseRenewalLink = "https://mattermost.com/renew/"
|
LicenseRenewalLink = "https://mattermost.com/renew/"
|
||||||
|
|
||||||
|
LicenseShortSkuE10 = "E10"
|
||||||
|
LicenseShortSkuE20 = "E20"
|
||||||
|
LicenseShortSkuProfessional = "professional"
|
||||||
|
LicenseShortSkuEnterprise = "enterprise"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -302,6 +307,13 @@ func (l *License) IsSanctionedTrial() bool {
|
|||||||
(duration >= sanctionedTrialDurationLowerBound.Milliseconds() || duration <= sanctionedTrialDurationUpperBound.Milliseconds())
|
(duration >= sanctionedTrialDurationLowerBound.Milliseconds() || duration <= sanctionedTrialDurationUpperBound.Milliseconds())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *License) HasEnterpriseMarketplacePlugins() bool {
|
||||||
|
return *l.Features.EnterprisePlugins ||
|
||||||
|
l.SkuShortName == LicenseShortSkuE20 ||
|
||||||
|
l.SkuShortName == LicenseShortSkuProfessional ||
|
||||||
|
l.SkuShortName == LicenseShortSkuEnterprise
|
||||||
|
}
|
||||||
|
|
||||||
// NewTestLicense returns a license that expires in the future and has the given features.
|
// NewTestLicense returns a license that expires in the future and has the given features.
|
||||||
func NewTestLicense(features ...string) *License {
|
func NewTestLicense(features ...string) *License {
|
||||||
ret := &License{
|
ret := &License{
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user