diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-07 16:20:51 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-07 16:20:51 -0600 |
commit | 0f703a3368a0b16fcd48b474377f0dbd2144f366 (patch) | |
tree | 4928199b534de6e1d42d8057c70ebe626b237d4a /app/license.go | |
parent | eff65aa05c74e93533c2504b8141b0474011e68c (diff) | |
download | chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.tar.gz chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.tar.bz2 chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.zip |
Eliminate utils.SetLicense calls (#8217)
* eliminate utils.SetLicense calls
* test fix
* another test fix
* more test fixes
Diffstat (limited to 'app/license.go')
-rw-r--r-- | app/license.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/license.go b/app/license.go index c7fd07197..7402b5c22 100644 --- a/app/license.go +++ b/app/license.go @@ -59,7 +59,7 @@ func (a *App) SaveLicense(licenseBytes []byte) (*model.License, *model.AppError) } } - if ok := utils.SetLicense(license); !ok { + if ok := a.SetLicense(license); !ok { return nil, model.NewAppError("addLicense", model.EXPIRED_LICENSE_ERROR, nil, "", http.StatusBadRequest) } @@ -102,6 +102,20 @@ func (a *App) SaveLicense(licenseBytes []byte) (*model.License, *model.AppError) return license, nil } +// License returns the currently active license or nil if the application is unlicensed. +func (a *App) License() *model.License { + if utils.IsLicensed() { + return utils.License() + } + return nil +} + +func (a *App) SetLicense(license *model.License) bool { + ok := utils.SetLicense(license) + a.SetDefaultRolesBasedOnConfig() + return ok +} + func (a *App) RemoveLicense() *model.AppError { utils.RemoveLicense() |