aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos')
-rw-r--r--server/middlewares/validators/videos/video-live.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts
index 69200cb60..cbc48fe93 100644
--- a/server/middlewares/validators/videos/video-live.ts
+++ b/server/middlewares/validators/videos/video-live.ts
@@ -16,14 +16,14 @@ const videoLiveGetValidator = [
16 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), 16 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
17 17
18 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 18 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
19 logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.body }) 19 logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.params, user: res.locals.oauth.token.User.username })
20 20
21 if (areValidationErrors(req, res)) return 21 if (areValidationErrors(req, res)) return
22 if (!await doesVideoExist(req.params.videoId, res, 'all')) return 22 if (!await doesVideoExist(req.params.videoId, res, 'all')) return
23 23
24 // Check if the user who did the request is able to update the video 24 // Check if the user who did the request is able to get the live info
25 const user = res.locals.oauth.token.User 25 const user = res.locals.oauth.token.User
26 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.UPDATE_ANY_VIDEO, res)) return 26 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res, false)) return
27 27
28 const videoLive = await VideoLiveModel.loadByVideoId(res.locals.videoAll.id) 28 const videoLive = await VideoLiveModel.loadByVideoId(res.locals.videoAll.id)
29 if (!videoLive) return res.sendStatus(404) 29 if (!videoLive) return res.sendStatus(404)
@@ -122,6 +122,10 @@ const videoLiveUpdateValidator = [
122 .json({ error: 'Cannot update a live that has already started' }) 122 .json({ error: 'Cannot update a live that has already started' })
123 } 123 }
124 124
125 // Check the user can manage the live
126 const user = res.locals.oauth.token.User
127 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res)) return
128
125 return next() 129 return next()
126 } 130 }
127] 131]