import { isAbleToUploadVideo } from '@server/lib/user'
import { getServerActor } from '@server/models/application/application'
import { ExpressPromiseHandler } from '@server/types/express'
-import { MVideoFullLight } from '@server/types/models'
+import { MVideoWithRights } from '@server/types/models'
import { ServerErrorCode, UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { VideoChangeOwnershipAccept } from '../../../../shared/models/videos/video-change-ownership-accept.model'
import { Hooks } from '../../../lib/plugins/hooks'
import { AccountModel } from '../../../models/account/account'
import { VideoModel } from '../../../models/video/video'
-import { authenticatePromiseIfNeeded } from '../../oauth'
+import { authenticatePromiseIfNeeded } from '../../auth'
import { areValidationErrors } from '../utils'
const videosAddValidator = getCommonVideoEditAttributes().concat([
// Controllers does not need to check video rights
if (fetchType === 'only-immutable-attributes') return next()
- const video = getVideoWithAttributes(res)
- const videoAll = video as MVideoFullLight
+ const video = getVideoWithAttributes(res) as MVideoWithRights
// Video private or blacklisted
- if (videoAll.requiresAuth()) {
+ if (video.requiresAuth()) {
await authenticatePromiseIfNeeded(req, res, authenticateInQuery)
const user = res.locals.oauth ? res.locals.oauth.token.User : null
// Only the owner or a user that have blacklist rights can see the video
- if (!user || !user.canGetVideo(videoAll)) {
+ if (!user || !user.canGetVideo(video)) {
return res.status(HttpStatusCode.FORBIDDEN_403)
.json({ error: 'Cannot get this private/internal or blacklisted video.' })
}