summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-23 15:52:59 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-23 15:52:59 -0700
commit00112cae5123b02eee79e8b991618ed5069e07b1 (patch)
treeba8862900e2ed84bd7f3b720227448e05fe88efa /store/sql_user_store.go
parent985aebf86120188c2a14adfab39af7c4da3c1c9d (diff)
downloadchat-00112cae5123b02eee79e8b991618ed5069e07b1.tar.gz
chat-00112cae5123b02eee79e8b991618ed5069e07b1.tar.bz2
chat-00112cae5123b02eee79e8b991618ed5069e07b1.zip
Assiging first user system_admin role
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r--store/sql_user_store.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 3fd1c82b5..0a723d965 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -481,3 +481,22 @@ func (us SqlUserStore) GetForExport(teamId string) StoreChannel {
return storeChannel
}
+
+func (us SqlUserStore) GetTotalUsersCount() StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users"); err != nil {
+ result.Err = model.NewAppError("SqlUserStore.GetTotalUsersCount", "We could not count the users", err.Error())
+ } else {
+ result.Data = count
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}