Check license expiration, disable license and notify administrator (#14420)

* Check license expiration and notify administrator
Этот коммит содержится в:
catalintomai
2020-05-06 10:28:49 -07:00
коммит произвёл GitHub
родитель 5ad3eaf7ee
Коммит 58305b080f
9 изменённых файлов: 175 добавлений и 0 удалений

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

@@ -12,6 +12,8 @@ import (
const (
EXPIRED_LICENSE_ERROR = "api.license.add_license.expired.app_error"
INVALID_LICENSE_ERROR = "api.license.add_license.invalid.app_error"
LICENSE_GRACE_PERIOD = 1000 * 60 * 60 * 24 * 10 //10 days
LICENSE_RENEWAL_LINK = "https://licensing.mattermost.com/renew"
)
type LicenseRecord struct {
@@ -194,6 +196,11 @@ func (l *License) IsExpired() bool {
return l.ExpiresAt < GetMillis()
}
func (l *License) IsPastGracePeriod() bool {
timeDiff := GetMillis() - l.ExpiresAt
return timeDiff > LICENSE_GRACE_PERIOD
}
func (l *License) IsStarted() bool {
return l.StartsAt < GetMillis()
}