[MM-58492] Remove subsequent check for team permissions on open channels (#27827)

* [MM-58492] Remove subsequent check for team permissions on open channels

* Removed extra check for open channel for webhooks as well

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Devin Binnie
2024-08-06 08:56:25 -04:00
committed by GitHub
co-authored by Mattermost Build
parent e776aa8956
commit 6ae03a098e
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -572,9 +572,7 @@ func getPostsByIds(c *Context, w http.ResponseWriter, r *http.Request) {
}
if !c.App.SessionHasPermissionToReadChannel(c.AppContext, *c.AppContext.Session(), channel) {
if channel.Type != model.ChannelTypeOpen || (channel.Type == model.ChannelTypeOpen && !c.App.SessionHasPermissionToTeam(*c.AppContext.Session(), channel.TeamId, model.PermissionReadPublicChannel)) {
continue
}
continue
}
post = c.App.PreparePostForClient(c.AppContext, post, false, false, true)
+1 -1
View File
@@ -51,7 +51,7 @@ func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if channel.Type != model.ChannelTypeOpen && !c.App.SessionHasPermissionToReadChannel(c.AppContext, *c.AppContext.Session(), channel) {
if !c.App.SessionHasPermissionToReadChannel(c.AppContext, *c.AppContext.Session(), channel) {
c.LogAudit("fail - bad channel permissions")
c.SetPermissionError(model.PermissionReadChannelContent)
return