MM-11520: Make entity ID checks consistent across api4. (#9395)

* MM-11520: Make entity ID checks consistent across api4.

* Update tests.
Этот коммит содержится в:
George Goldberg
2018-09-14 16:21:05 +01:00
коммит произвёл Christopher Speller
родитель 83a00ae925
Коммит fdbb6de3d5
8 изменённых файлов: 70 добавлений и 22 удалений

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

@@ -382,6 +382,12 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// The post being updated in the payload must be the same one as indicated in the URL.
if post.Id != c.Params.PostId {
c.SetInvalidParam("post_id")
return
}
if !c.App.SessionHasPermissionToChannelByPost(c.Session, c.Params.PostId, model.PERMISSION_EDIT_POST) {
c.SetPermissionError(model.PERMISSION_EDIT_POST)
return