mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[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>
This commit is contained in:
@@ -720,7 +720,7 @@ func (s *Server) getBaseMarketplaceFilter() *model.MarketplacePluginFilter {
|
||||
}
|
||||
|
||||
license := s.License()
|
||||
if license != nil && *license.Features.EnterprisePlugins {
|
||||
if license != nil && license.HasEnterpriseMarketplacePlugins() {
|
||||
filter.EnterprisePlugins = true
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ const (
|
||||
InvalidLicenseError = "api.license.add_license.invalid.app_error"
|
||||
LicenseGracePeriod = 1000 * 60 * 60 * 24 * 10 //10 days
|
||||
LicenseRenewalLink = "https://mattermost.com/renew/"
|
||||
|
||||
LicenseShortSkuE10 = "E10"
|
||||
LicenseShortSkuE20 = "E20"
|
||||
LicenseShortSkuProfessional = "professional"
|
||||
LicenseShortSkuEnterprise = "enterprise"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -302,6 +307,13 @@ func (l *License) IsSanctionedTrial() bool {
|
||||
(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.
|
||||
func NewTestLicense(features ...string) *License {
|
||||
ret := &License{
|
||||
|
||||
Reference in New Issue
Block a user