diff options
Diffstat (limited to 'api4')
-rw-r--r-- | api4/channel_test.go | 15 | ||||
-rw-r--r-- | api4/context.go | 2 | ||||
-rw-r--r-- | api4/user_test.go | 3 |
3 files changed, 15 insertions, 5 deletions
diff --git a/api4/channel_test.go b/api4/channel_test.go index e8e79cebd..987678ee0 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -92,10 +92,10 @@ func TestCreateChannel(t *testing.T) { }() *utils.Cfg.TeamSettings.RestrictPublicChannelCreation = model.PERMISSIONS_ALL *utils.Cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_ALL - utils.SetDefaultRolesBasedOnConfig() utils.IsLicensed = true utils.License = &model.License{Features: &model.Features{}} utils.License.Features.SetDefaults() + utils.SetDefaultRolesBasedOnConfig() channel.Name = GenerateTestChannelName() _, resp = Client.CreateChannel(channel) @@ -161,6 +161,19 @@ func TestCreateChannel(t *testing.T) { _, resp = th.SystemAdminClient.CreateChannel(private) CheckNoError(t, resp) + // Check that if unlicensed the policy restriction is not enforced. + utils.IsLicensed = false + utils.License = nil + utils.SetDefaultRolesBasedOnConfig() + + channel.Name = GenerateTestChannelName() + _, resp = Client.CreateChannel(channel) + CheckNoError(t, resp) + + private.Name = GenerateTestChannelName() + _, resp = Client.CreateChannel(private) + CheckNoError(t, resp) + if r, err := Client.DoApiPost("/channels", "garbage"); err == nil { t.Fatal("should have errored") } else { diff --git a/api4/context.go b/api4/context.go index 9fb1361bc..8f663431d 100644 --- a/api4/context.go +++ b/api4/context.go @@ -133,7 +133,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId) - w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v", model.CurrentVersion, model.BuildNumber, utils.CfgHash)) + w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, utils.CfgHash, utils.IsLicensed)) if einterfaces.GetClusterInterface() != nil { w.Header().Set(model.HEADER_CLUSTER_ID, einterfaces.GetClusterInterface().GetClusterId()) } diff --git a/api4/user_test.go b/api4/user_test.go index 53dbd53e8..6a42d19d2 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -177,9 +177,6 @@ func TestGetUserByUsername(t *testing.T) { _, resp = Client.GetUserByUsername(GenerateTestUsername(), "") CheckNotFoundStatus(t, resp) - _, resp = Client.GetUserByUsername(model.NewRandomString(1), "") - CheckBadRequestStatus(t, resp) - // Check against privacy config settings emailPrivacy := utils.Cfg.PrivacySettings.ShowEmailAddress namePrivacy := utils.Cfg.PrivacySettings.ShowFullName |