diff options
author | =Corey Hulen <corey@hulen.com> | 2015-11-15 18:18:02 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-11-16 11:34:29 -0800 |
commit | 03c6dcbd865e2af2db5db150189504bfa493ae2e (patch) | |
tree | 360d2ece83de79d3df338d581216e4282b420209 /store/sql_webhook_store.go | |
parent | 48d2f86b90b3e0b02cb28f3e8b6e4d454f9cb869 (diff) | |
download | chat-03c6dcbd865e2af2db5db150189504bfa493ae2e.tar.gz chat-03c6dcbd865e2af2db5db150189504bfa493ae2e.tar.bz2 chat-03c6dcbd865e2af2db5db150189504bfa493ae2e.zip |
PLT-975 adding perm deletes
Diffstat (limited to 'store/sql_webhook_store.go')
-rw-r--r-- | store/sql_webhook_store.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go index c758e2339..11b9f6e52 100644 --- a/store/sql_webhook_store.go +++ b/store/sql_webhook_store.go @@ -116,6 +116,24 @@ func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) StoreChann return storeChannel } +func (s SqlWebhookStore) DeleteIncomingByUser(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + _, err := s.GetMaster().Exec("DELETE FROM IncomingWebhooks WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) + if err != nil { + result.Err = model.NewAppError("SqlWebhookStore.DeleteIncomingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel { storeChannel := make(StoreChannel) @@ -294,6 +312,24 @@ func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) StoreChann return storeChannel } +func (s SqlWebhookStore) DeleteOutgoingByUser(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + _, err := s.GetMaster().Exec("DELETE FROM OutgoingWebhooks WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId}) + if err != nil { + result.Err = model.NewAppError("SqlWebhookStore.DeleteOutgoingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel { storeChannel := make(StoreChannel) |