summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/license.go13
-rw-r--r--model/user.go1
-rw-r--r--utils/license.go3
-rw-r--r--web/react/components/admin_console/system_analytics.jsx2
-rw-r--r--web/react/components/admin_console/team_analytics.jsx4
5 files changed, 20 insertions, 3 deletions
diff --git a/api/license.go b/api/license.go
index 5b3809651..fc2fd4384 100644
--- a/api/license.go
+++ b/api/license.go
@@ -5,6 +5,7 @@ package api
import (
"bytes"
+ "fmt"
l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/platform/model"
@@ -63,6 +64,18 @@ func addLicense(c *Context, w http.ResponseWriter, r *http.Request) {
if success, licenseStr := utils.ValidateLicense(data); success {
license = model.LicenseFromJson(strings.NewReader(licenseStr))
+ if result := <-Srv.Store.User().AnalyticsUniqueUserCount(""); result.Err != nil {
+ c.Err = model.NewAppError("addLicense", "Unable to count total unique users.", fmt.Sprintf("err=%v", result.Err.Error()))
+ return
+ } else {
+ uniqueUserCount := result.Data.(int64)
+
+ if uniqueUserCount > int64(*license.Features.Users) {
+ c.Err = model.NewAppError("addLicense", fmt.Sprintf("This license only supports %d users, when your system has %d unique users. Unique users are counted distinctly by email address. You can see total user count under Site Reports -> View Statistics.", *license.Features.Users, uniqueUserCount), "")
+ return
+ }
+ }
+
if ok := utils.SetLicense(license); !ok {
c.LogAudit("failed - expired or non-started license")
c.Err = model.NewAppError("addLicense", "License is either expired or has not yet started.", "")
diff --git a/model/user.go b/model/user.go
index 7744b0073..44228d93f 100644
--- a/model/user.go
+++ b/model/user.go
@@ -236,7 +236,6 @@ func (u *User) Sanitize(options map[string]bool) {
}
func (u *User) ClearNonProfileFields() {
- u.CreateAt = 0
u.UpdateAt = 0
u.Password = ""
u.AuthData = ""
diff --git a/utils/license.go b/utils/license.go
index 7594e33af..4fba94d4d 100644
--- a/utils/license.go
+++ b/utils/license.go
@@ -55,6 +55,7 @@ func LoadLicense() {
if success, licenseStr := ValidateLicense(buf.Bytes()); success {
license := model.LicenseFromJson(strings.NewReader(licenseStr))
SetLicense(license)
+ return
}
l4g.Warn("No valid enterprise license found")
@@ -105,7 +106,7 @@ func ValidateLicense(signed []byte) (bool, string) {
}
// remove null terminator
- if decoded[len(decoded)-1] == byte(0) {
+ for decoded[len(decoded)-1] == byte(0) {
decoded = decoded[:len(decoded)-1]
}
diff --git a/web/react/components/admin_console/system_analytics.jsx b/web/react/components/admin_console/system_analytics.jsx
index 640f17ff0..fffe7cc53 100644
--- a/web/react/components/admin_console/system_analytics.jsx
+++ b/web/react/components/admin_console/system_analytics.jsx
@@ -142,7 +142,7 @@ export default class SystemAnalytics extends React.Component {
return (
<div>
<Analytics
- title={'the system'}
+ title={'the System'}
channelOpenCount={this.state.channel_open_count}
channelPrivateCount={this.state.channel_private_count}
postCount={this.state.post_count}
diff --git a/web/react/components/admin_console/team_analytics.jsx b/web/react/components/admin_console/team_analytics.jsx
index baa041bac..c164dd98c 100644
--- a/web/react/components/admin_console/team_analytics.jsx
+++ b/web/react/components/admin_console/team_analytics.jsx
@@ -152,6 +152,10 @@ export default class TeamAnalytics extends React.Component {
var recentActive = [];
for (let i = 0; i < usersList.length; i++) {
+ if (usersList[i].last_activity_at == null) {
+ continue;
+ }
+
recentActive.push(usersList[i]);
if (i > 19) {
break;