[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>
Этот коммит содержится в:
Devin Binnie
2024-08-06 08:56:25 -04:00
коммит произвёл GitHub
родитель e776aa8956
Коммит 6ae03a098e
2 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@@ -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 !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) post = c.App.PreparePostForClient(c.AppContext, post, false, false, true)

Просмотреть файл

@@ -51,7 +51,7 @@ func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
return 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.LogAudit("fail - bad channel permissions")
c.SetPermissionError(model.PermissionReadChannelContent) c.SetPermissionError(model.PermissionReadChannelContent)
return return