MM-47228 - restrict guest invitation flow if subscription plan does n… (#21195)

* MM-47228 - restrict guest invitation flow if subscription plan does not support it

* fix i18n texts and add unit test

* test the scenario where guest invites are blocked by subscription

* cover the success scenarios for cloud free trial and paid subscription

* fix go vet

* use the cloud prefix for the sku

* fix unit tests

* check the licence value to determine if the guest accounts are enabled

* remove unnecessary changes for getting the subscription information

* restrict user demotion if guestAccounts is not available in license

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Этот коммит содержится в:
Pablo Andrés Vélez Vidal
2022-10-07 15:57:44 +02:00
коммит произвёл GitHub
родитель 6e9b808efd
Коммит 9a804a96fe
6 изменённых файлов: 109 добавлений и 10 удалений

Просмотреть файл

@@ -326,6 +326,25 @@ func NewTestLicense(features ...string) *License {
return ret
}
// NewTestLicense returns a license that expires in the future and set as false the given features.
func NewTestLicenseWithFalseDefaults(features ...string) *License {
ret := &License{
ExpiresAt: GetMillis() + 90*DayInMilliseconds,
Customer: &Customer{},
Features: &Features{},
}
ret.Features.SetDefaults()
featureMap := map[string]bool{}
for _, feature := range features {
featureMap[feature] = false
}
featureJson, _ := json.Marshal(featureMap)
json.Unmarshal(featureJson, &ret.Features)
return ret
}
func NewTestLicenseSKU(skuShortName string, features ...string) *License {
lic := NewTestLicense(features...)
lic.SkuShortName = skuShortName