Fix playlist get for classic users
This commit is contained in:
parent
ff0bce1359
commit
964298de4e
|
@ -140,9 +140,10 @@ const videoPlaylistsGetValidator = [
|
||||||
await authenticatePromiseIfNeeded(req, res)
|
await authenticatePromiseIfNeeded(req, res)
|
||||||
|
|
||||||
const user = res.locals.oauth ? res.locals.oauth.token.User : null
|
const user = res.locals.oauth ? res.locals.oauth.token.User : null
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!user ||
|
!user ||
|
||||||
(videoPlaylist.OwnerAccount.userId !== user.id && !user.hasRight(UserRight.UPDATE_ANY_VIDEO_PLAYLIST))
|
(videoPlaylist.OwnerAccount.id !== user.Account.id && !user.hasRight(UserRight.UPDATE_ANY_VIDEO_PLAYLIST))
|
||||||
) {
|
) {
|
||||||
return res.status(403)
|
return res.status(403)
|
||||||
.json({ error: 'Cannot get this private video playlist.' })
|
.json({ error: 'Cannot get this private video playlist.' })
|
||||||
|
|
|
@ -36,7 +36,8 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
uploadVideoAndGetId,
|
uploadVideoAndGetId,
|
||||||
userLogin,
|
userLogin,
|
||||||
waitJobs
|
waitJobs,
|
||||||
|
generateUserAccessToken
|
||||||
} from '../../../../shared/extra-utils'
|
} from '../../../../shared/extra-utils'
|
||||||
import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
|
import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
|
||||||
import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model'
|
import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model'
|
||||||
|
@ -138,6 +139,18 @@ describe('Test video playlists', function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should get private playlist for a classic user', async function () {
|
||||||
|
const token = await generateUserAccessToken(servers[0], 'toto')
|
||||||
|
|
||||||
|
const res = await getAccountPlaylistsListWithToken(servers[0].url, token, 'toto', 0, 5)
|
||||||
|
|
||||||
|
expect(res.body.total).to.equal(1)
|
||||||
|
expect(res.body.data).to.have.lengthOf(1)
|
||||||
|
|
||||||
|
const playlistId = res.body.data[0].id
|
||||||
|
await getPlaylistVideos(servers[0].url, token, playlistId, 0, 5)
|
||||||
|
})
|
||||||
|
|
||||||
it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () {
|
it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(30000)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue