[MM-64453] Guest shouldn't discover public channels that they are not member of (#31327) (#33778)

Automatic Merge
Этот коммит содержится в:
Mattermost Build
2025-08-22 12:04:05 +03:00
коммит произвёл GitHub
родитель 24c4a3677b
Коммит e8c7e7d025
2 изменённых файлов: 103 добавлений и 39 удалений

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

@@ -999,6 +999,15 @@ func getPublicChannelsByIdsForTeam(c *Context, w http.ResponseWriter, r *http.Re
return
}
if session := c.AppContext.Session(); session.IsGuest() {
for _, channel := range channels {
if !c.App.SessionHasPermissionToChannel(c.AppContext, *session, channel.Id, model.PermissionReadChannel) {
c.SetPermissionError(model.PermissionReadChannel)
return
}
}
}
appErr = c.App.FillInChannelsProps(c.AppContext, channels)
if appErr != nil {
c.Err = appErr