Fix user issue sending POST requests to play endpoints #473

This commit is contained in:
advplyr 2022-04-21 07:24:54 -05:00
parent f2d9de5a5f
commit 1ff5637c1b

View File

@ -353,11 +353,13 @@ class LibraryItemController {
return res.sendStatus(403)
}
if (req.method == 'DELETE' && !req.user.canDelete) {
if (req.path.includes('/play')) {
// allow POST requests using /play and /play/:episodeId
} else if (req.method == 'DELETE' && !req.user.canDelete) {
Logger.warn(`[LibraryItemController] User attempted to delete without permission`, req.user)
return res.sendStatus(403)
} else if ((req.method == 'PATCH' || req.method == 'POST') && !req.user.canUpdate) {
Logger.warn('[LibraryItemController] User attempted to update without permission', req.user)
Logger.warn('[LibraryItemController] User attempted to update without permission', req.user.username)
return res.sendStatus(403)
}