From 00112cae5123b02eee79e8b991618ed5069e07b1 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 23 Sep 2015 15:52:59 -0700 Subject: Assiging first user system_admin role --- store/sql_user_store.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'store/sql_user_store.go') 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 +} -- cgit v1.2.3-1-g7c22