From a930eef71dc398fff8ce1a7fdffec8522b9c34f9 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Wed, 25 Jan 2017 13:12:04 +0000 Subject: PLT-4858: Allow system admin to delete all channels. (#5180) The app-package refactor means that the check for a Channel Member object before allowing to delete the channel is now redundant, as the check is already carried out by using HasPermissionToChannel() on the user requesting it. As a result, System Admins can now delete channels through the API even if they aren't members. --- app/channel.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app') diff --git a/app/channel.go b/app/channel.go index b8e02a149..1844e3177 100644 --- a/app/channel.go +++ b/app/channel.go @@ -243,14 +243,11 @@ func UpdateChannelMemberNotifyProps(data map[string]string, channelId string, us func DeleteChannel(channel *model.Channel, userId string) *model.AppError { uc := Srv.Store.User().Get(userId) - scm := Srv.Store.Channel().GetMember(channel.Id, userId) ihc := Srv.Store.Webhook().GetIncomingByChannel(channel.Id) ohc := Srv.Store.Webhook().GetOutgoingByChannel(channel.Id) if uresult := <-uc; uresult.Err != nil { return uresult.Err - } else if scmresult := <-scm; scmresult.Err != nil { - return scmresult.Err } else if ihcresult := <-ihc; ihcresult.Err != nil { return ihcresult.Err } else if ohcresult := <-ohc; ohcresult.Err != nil { @@ -259,7 +256,6 @@ func DeleteChannel(channel *model.Channel, userId string) *model.AppError { user := uresult.Data.(*model.User) incomingHooks := ihcresult.Data.([]*model.IncomingWebhook) outgoingHooks := ohcresult.Data.([]*model.OutgoingWebhook) - // Don't need to do anything with channel member, just wanted to confirm it exists if channel.DeleteAt > 0 { err := model.NewLocAppError("deleteChannel", "api.channel.delete_channel.deleted.app_error", nil, "") -- cgit v1.2.3-1-g7c22