Premium SKU (#30396)
* Added premium SKU * removed duplicate enterprise license check functions * Added license check on API layer * lint fix * lint fix * refactured signature: * test: Add comprehensive tests for license tier check functions * fixed test * text update * optimised license checks * fixedf test * Updated license valid function * webapp license checks * handling prekium SKU in webappp: * added plugin api method and general refactoring * Updated tests --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
21ca303b5e
Коммит
a9f09cadc2
@@ -1465,7 +1465,7 @@ func (a *App) allowChannelMentions(c request.CTX, post *model.Post, numProfiles
|
||||
|
||||
// allowGroupMentions returns whether or not the group mentions are allowed for the given post.
|
||||
func (a *App) allowGroupMentions(c request.CTX, post *model.Post) bool {
|
||||
if license := a.Srv().License(); license == nil || (license.SkuShortName != model.LicenseShortSkuProfessional && license.SkuShortName != model.LicenseShortSkuEnterprise) {
|
||||
if !model.MinimumProfessionalLicense(a.Srv().License()) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -670,7 +670,6 @@ func (a *App) mergePrepackagedPlugins(remoteMarketplacePlugins map[string]*model
|
||||
return model.NewAppError("mergePrepackagedPlugins", "app.plugin.config.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
isEnterpriseLicense := a.License() != nil && a.License().IsE20OrEnterprise()
|
||||
for _, prepackaged := range pluginsEnvironment.PrepackagedPlugins() {
|
||||
if prepackaged.Manifest == nil {
|
||||
continue
|
||||
@@ -687,7 +686,7 @@ func (a *App) mergePrepackagedPlugins(remoteMarketplacePlugins map[string]*model
|
||||
|
||||
// If not enterprise, check version.
|
||||
// Playbooks is not listed in the marketplace, this only handles prepackaged.
|
||||
if !isEnterpriseLicense {
|
||||
if !model.MinimumEnterpriseLicense(a.License()) {
|
||||
if prepackaged.Manifest.Id == model.PluginIdPlaybooks {
|
||||
version, err := semver.Parse(prepackaged.Manifest.Version)
|
||||
if err != nil {
|
||||
@@ -1033,8 +1032,8 @@ func (ch *Channels) processPrepackagedPlugin(pluginPath *pluginSignaturePath) (*
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Unable to verify prepackaged playbooks version")
|
||||
}
|
||||
license := ch.License()
|
||||
hasEnterpriseLicense := license != nil && license.IsE20OrEnterprise()
|
||||
|
||||
hasEnterpriseLicense := model.MinimumEnterpriseLicense(ch.License())
|
||||
|
||||
// Do not install playbooks >=v2 if we do not have an enterprise license
|
||||
if version.GTE(SemVerV2) && !hasEnterpriseLicense {
|
||||
@@ -1105,15 +1104,13 @@ func (ch *Channels) pluginIsTransitionallyPrepackaged(m *model.Manifest) bool {
|
||||
// - the server is not enterprise licensed
|
||||
// - the playbooks version is <v2
|
||||
func (ch *Channels) playbooksIsTransitionallyPrepackaged(m *model.Manifest) bool {
|
||||
license := ch.srv.License()
|
||||
isNotEnterpriseLicensed := !(license != nil && license.IsE20OrEnterprise())
|
||||
version, err := semver.Parse(m.Version)
|
||||
if err != nil {
|
||||
ch.srv.Log().Warn("unable to parse prepackaged playbooks version - not marking it as transitional.", mlog.String("version", m.Version), mlog.Err(err))
|
||||
return false
|
||||
}
|
||||
|
||||
return isNotEnterpriseLicensed && version.LT(SemVerV2)
|
||||
return !model.MinimumEnterpriseLicense(ch.srv.License()) && version.LT(SemVerV2)
|
||||
}
|
||||
|
||||
// shouldPersistTransitionallyPrepackagedPlugin determines if a transitionally prepackaged plugin
|
||||
|
||||
@@ -55,16 +55,14 @@ func postPriorityCheck(
|
||||
}
|
||||
|
||||
if ack := priority.RequestedAck; ack != nil && *ack {
|
||||
licenseErr := model.MinimumProfessionalProvidedLicense(license)
|
||||
if licenseErr != nil {
|
||||
return licenseErr
|
||||
if !model.MinimumProfessionalLicense(license) {
|
||||
return model.NewAppError("", "license_error.feature_unavailable", nil, "feature is not available for the current license", http.StatusNotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
if notification := priority.PersistentNotifications; notification != nil && *notification {
|
||||
licenseErr := model.MinimumProfessionalProvidedLicense(license)
|
||||
if licenseErr != nil {
|
||||
return licenseErr
|
||||
if !model.MinimumProfessionalLicense(license) {
|
||||
return model.NewAppError("", "license_error.feature_unavailable", nil, "feature is not available for the current license", http.StatusNotImplemented)
|
||||
}
|
||||
if !isPersistentNotificationsEnabled {
|
||||
return priorityForbiddenErr
|
||||
|
||||
@@ -199,7 +199,7 @@ func (a *App) GetUserCountForReport(filter *model.UserReportOptions) (*int64, *m
|
||||
}
|
||||
|
||||
func (a *App) StartUsersBatchExport(rctx request.CTX, ro *model.UserReportOptions, startAt int64, endAt int64) *model.AppError {
|
||||
if license := a.Srv().License(); license == nil || (license.SkuShortName != model.LicenseShortSkuProfessional && license.SkuShortName != model.LicenseShortSkuEnterprise) {
|
||||
if !model.MinimumProfessionalLicense(a.Srv().License()) {
|
||||
return model.NewAppError("StartUsersBatchExport", "app.report.start_users_batch_export.license_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user