diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/config.go | 2 | ||||
-rw-r--r-- | utils/license.go | 37 |
2 files changed, 6 insertions, 33 deletions
diff --git a/utils/config.go b/utils/config.go index e9b7e1878..3e4ba5c5b 100644 --- a/utils/config.go +++ b/utils/config.go @@ -202,6 +202,8 @@ func getClientConfig(c *model.Config) map[string]string { props["GoogleDeveloperKey"] = c.ServiceSettings.GoogleDeveloperKey props["EnableIncomingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableIncomingWebhooks) props["EnableOutgoingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableOutgoingWebhooks) + props["EnableCommands"] = strconv.FormatBool(*c.ServiceSettings.EnableCommands) + props["EnableOnlyAdminIntegrations"] = strconv.FormatBool(*c.ServiceSettings.EnableOnlyAdminIntegrations) props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride) props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride) props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper) diff --git a/utils/license.go b/utils/license.go index 0d1cd597c..b773a163e 100644 --- a/utils/license.go +++ b/utils/license.go @@ -1,19 +1,15 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package utils import ( - "bytes" "crypto" "crypto/rsa" "crypto/sha512" "crypto/x509" "encoding/base64" "encoding/pem" - "io" - "os" - "path/filepath" "strconv" "strings" @@ -22,10 +18,6 @@ import ( "github.com/mattermost/platform/model" ) -const ( - LICENSE_FILENAME = "active.dat" -) - var IsLicensed bool = false var License *model.License = &model.License{} var ClientLicense map[string]string = make(map[string]string) @@ -41,18 +33,8 @@ NxpC+5KFhU+xSeeklNqwCgnlOyZ7qSTxmdJHb+60SwuYnnGIYzLJhY4LYDr4J+KR 1wIDAQAB -----END PUBLIC KEY-----`) -func LoadLicense() { - file, err := os.Open(LicenseLocation()) - if err != nil { - l4g.Warn(T("utils.license.load_license.open_find.warn")) - return - } - defer file.Close() - - buf := bytes.NewBuffer(nil) - io.Copy(buf, file) - - if success, licenseStr := ValidateLicense(buf.Bytes()); success { +func LoadLicense(licenseBytes []byte) { + if success, licenseStr := ValidateLicense(licenseBytes); success { license := model.LicenseFromJson(strings.NewReader(licenseStr)) SetLicense(license) return @@ -74,21 +56,10 @@ func SetLicense(license *model.License) bool { return false } -func LicenseLocation() string { - return filepath.Dir(CfgFileName) + "/" + LICENSE_FILENAME -} - -func RemoveLicense() bool { +func RemoveLicense() { License = &model.License{} IsLicensed = false ClientLicense = getClientLicense(License) - - if err := os.Remove(LicenseLocation()); err != nil { - l4g.Error(T("utils.license.remove_license.unable.error"), err.Error()) - return false - } - - return true } func ValidateLicense(signed []byte) (bool, string) { |