diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-11-18 12:48:45 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-11-18 12:48:45 -0500 |
commit | e408d615c02ae3c863df3c7dc13d1b813c22fd28 (patch) | |
tree | a1c607b7721831c71aadbf89f018ed7b11a0e426 /store/sql_user_store.go | |
parent | 9660adb00775aba822d2d684d215c55679a456c6 (diff) | |
parent | c115191d6b5abdefda856c063e3f9048dc82f830 (diff) | |
download | chat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.tar.gz chat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.tar.bz2 chat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.zip |
Merge pull request #1448 from mattermost/PLT-975
PLT-975 adding delete to command line tool
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 77ff5bfab..d19135b64 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -554,3 +554,21 @@ func (us SqlUserStore) GetTotalActiveUsersCount() StoreChannel { return storeChannel } + +func (us SqlUserStore) PermanentDelete(userId string) StoreChannel { + + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + if _, err := us.GetMaster().Exec("DELETE FROM Users WHERE Id = :UserId", map[string]interface{}{"UserId": userId}); err != nil { + result.Err = model.NewAppError("SqlUserStore.GetByEmail", "We couldn't delete the existing account", "userId="+userId+", "+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |