mirror of
https://github.com/mattermost/mattermost.git
synced 2026-10-29 18:53:04 +08:00
[MM-70130] Add permanent banner for non-production developer license keys (#37846)
* [MM-70130] Add permanent banner for non-production developer license keys Co-authored-by: nick.misasi <nick.misasi@mattermost.com> * [MM-70130] Update non-production license banner text Co-authored-by: Nick Misasi <nick13misasi@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Nick Misasi
Cursor Agent
parent
bf194bc9d4
commit
68535c13bc
@@ -412,6 +412,7 @@ func (ps *PlatformService) logLicense(message string, license *model.License) {
|
||||
mlog.String("sku_short_name", license.SkuShortName),
|
||||
mlog.Bool("is_trial", license.IsTrial),
|
||||
mlog.Bool("is_gov_sku", license.IsGovSku),
|
||||
mlog.Bool("is_non_production", license.IsNonProduction),
|
||||
)
|
||||
|
||||
if license.Customer != nil {
|
||||
|
||||
@@ -152,6 +152,7 @@ func (ps *PlatformService) getSupportPacketDiagnostics(rctx request.CTX) (*model
|
||||
d.License.SkuShortName = license.SkuShortName
|
||||
d.License.IsTrial = license.IsTrial
|
||||
d.License.IsGovSKU = license.IsGovSku
|
||||
d.License.IsNonProduction = license.IsNonProduction
|
||||
}
|
||||
|
||||
/* Server */
|
||||
|
||||
@@ -264,6 +264,7 @@ func GetClientLicense(l *model.License) map[string]string {
|
||||
props["OutgoingOAuthConnections"] = strconv.FormatBool(*l.Features.OutgoingOAuthConnections)
|
||||
props["IsTrial"] = strconv.FormatBool(l.IsTrial)
|
||||
props["IsGovSku"] = strconv.FormatBool(l.IsGovSku)
|
||||
props["IsNonProduction"] = strconv.FormatBool(l.IsNonProduction)
|
||||
}
|
||||
|
||||
return props
|
||||
|
||||
@@ -253,6 +253,25 @@ func TestGetLicenseFileLocation(t *testing.T) {
|
||||
require.Equal(t, fileName, "mattermost.mattermost-license", "invalid file name")
|
||||
}
|
||||
|
||||
func TestGetClientLicense(t *testing.T) {
|
||||
license := &model.License{
|
||||
Customer: &model.Customer{},
|
||||
Features: &model.Features{},
|
||||
}
|
||||
license.Features.SetDefaults()
|
||||
|
||||
props := GetClientLicense(license)
|
||||
require.Equal(t, "false", props["IsNonProduction"])
|
||||
|
||||
license.IsNonProduction = true
|
||||
props = GetClientLicense(license)
|
||||
require.Equal(t, "true", props["IsNonProduction"])
|
||||
|
||||
// The flag must survive sanitization so all users can see the non-production banner.
|
||||
sanitized := GetSanitizedClientLicense(props)
|
||||
require.Equal(t, "true", sanitized["IsNonProduction"])
|
||||
}
|
||||
|
||||
func TestGetLicenseFileFromDisk(t *testing.T) {
|
||||
t.Run("missing file", func(t *testing.T) {
|
||||
fileBytes := GetLicenseFileFromDisk("thisfileshouldnotexist.mattermost-license")
|
||||
|
||||
Reference in New Issue
Block a user