коммит произвёл
GitHub
родитель
c0ea57ac6c
Коммит
36ac3a43b1
@@ -6,6 +6,7 @@ package api4
|
||||
import (
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/app"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/utils"
|
||||
)
|
||||
|
||||
func userCreatePostPermissionCheckWithContext(c *Context, channelId string) {
|
||||
@@ -69,3 +70,14 @@ func checkUploadFilePermissionForNewFiles(c *Context, newFileIds []string, origi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkEditFileAttachmentPermission checks edit_file_attachment permission
|
||||
// when file IDs are being changed (files added or removed) during post edit.
|
||||
func checkEditFileAttachmentPermission(c *Context, newFileIds []string, originalPost *model.Post) {
|
||||
if utils.SliceEqualUnordered(newFileIds, originalPost.FileIds) {
|
||||
return
|
||||
}
|
||||
if ok, _ := c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), originalPost.ChannelId, model.PermissionEditFileAttachment); !ok {
|
||||
c.SetPermissionError(model.PermissionEditFileAttachment)
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user