MM-63316: Guest access to channel (#30467)

Этот коммит содержится в:
catalintomai
2025-04-14 13:07:50 +02:00
коммит произвёл GitHub
родитель dba5fc927b
Коммит c23f44fe8e
3 изменённых файлов: 52 добавлений и 0 удалений

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

@@ -1846,6 +1846,13 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// Security check: if the user is a guest, they must have access to the channel
// to view its members
if c.AppContext.Session().IsGuest() && !c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), c.Params.ChannelId, model.PermissionReadChannel) {
c.SetPermissionError(model.PermissionReadChannel)
return
}
if channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup {
c.Err = model.NewAppError("addUserToChannel", "api.channel.add_user_to_channel.type.app_error", nil, "", http.StatusBadRequest)
return