diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-08-26 12:49:07 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-04 11:11:38 -0400 |
commit | f0fd9a9e8b85544089246bde71b6d61ba90eeb0e (patch) | |
tree | 256896117078ef1396a52fcecf3116863b3bb716 /store/sql_user_store.go | |
parent | 1b923528448eace438a1f498116a19361a8b0fb2 (diff) | |
download | chat-f0fd9a9e8b85544089246bde71b6d61ba90eeb0e.tar.gz chat-f0fd9a9e8b85544089246bde71b6d61ba90eeb0e.tar.bz2 chat-f0fd9a9e8b85544089246bde71b6d61ba90eeb0e.zip |
Adding ability to export data from mattermost
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 64a18545a..be1d29df0 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -452,3 +452,30 @@ func (us SqlUserStore) VerifyEmail(userId string) StoreChannel { return storeChannel } + +func (us SqlUserStore) GetForExport(teamId string) StoreChannel { + + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var users []*model.User + + if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { + result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encounted an error while finding user profiles", err.Error()) + } else { + for _, u := range users { + u.Password = "" + u.AuthData = "" + } + + result.Data = users + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |