diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-12 12:02:54 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 12:02:54 -0600 |
commit | 1ae680aefae2deb1e9d07d7c2a1c863ec807a79f (patch) | |
tree | a99a74d6b858d73624c06f85e393acbe97c90586 /model/license.go | |
parent | 9707ac3aaf2cb4352c573aadf54b8535e237dd9e (diff) | |
parent | 07fd7aeeb8eb2b198b01b713a4ab57f6352faef2 (diff) | |
download | chat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.tar.gz chat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.tar.bz2 chat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.zip |
Merge branch 'master' into release-4.7
Diffstat (limited to 'model/license.go')
-rw-r--r-- | model/license.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/model/license.go b/model/license.go index f96cba06c..942a18d55 100644 --- a/model/license.go +++ b/model/license.go @@ -173,6 +173,25 @@ func (l *License) ToJson() string { return string(b) } +// NewTestLicense returns a license that expires in the future and has the given features. +func NewTestLicense(features ...string) *License { + ret := &License{ + ExpiresAt: GetMillis() + 90*24*60*60*1000, + Customer: &Customer{}, + Features: &Features{}, + } + ret.Features.SetDefaults() + + featureMap := map[string]bool{} + for _, feature := range features { + featureMap[feature] = true + } + featureJson, _ := json.Marshal(featureMap) + json.Unmarshal(featureJson, &ret.Features) + + return ret +} + func LicenseFromJson(data io.Reader) *License { var o *License json.NewDecoder(data).Decode(&o) |