mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-29 20:14:02 -06:00
Server: rights check for update a video
This commit is contained in:
parent
d8cc063e97
commit
45abb8b97b
@ -53,6 +53,14 @@ function videosUpdate (req, res, next) {
|
||||
logger.debug('Checking videosUpdate parameters', { parameters: req.body })
|
||||
|
||||
checkErrors(req, res, function () {
|
||||
if (res.locals.video.isOwned() === false) {
|
||||
return res.status(403).send('Cannot update video of another pod')
|
||||
}
|
||||
|
||||
if (res.locals.video.Author.userId !== res.locals.oauth.token.User.id) {
|
||||
return res.status(403).send('Cannot update video of another user')
|
||||
}
|
||||
|
||||
checkVideoExists(req.params.id, res, next)
|
||||
})
|
||||
}
|
||||
|
@ -378,6 +378,10 @@ describe('Test videos API validator', function () {
|
||||
}
|
||||
requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done)
|
||||
})
|
||||
|
||||
it('Should fail with a video of another user')
|
||||
|
||||
it('Should fail with a video of another pod')
|
||||
})
|
||||
|
||||
describe('When getting a video', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user