mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
20
server/core/helpers/custom-validators/video-ownership.ts
Normal file
20
server/core/helpers/custom-validators/video-ownership.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Response } from 'express'
|
||||
import { HttpStatusCode } from '@peertube/peertube-models'
|
||||
import { MUserId } from '@server/types/models/index.js'
|
||||
import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership.js'
|
||||
|
||||
function checkUserCanTerminateOwnershipChange (user: MUserId, videoChangeOwnership: MVideoChangeOwnershipFull, res: Response) {
|
||||
if (videoChangeOwnership.NextOwner.userId === user.id) {
|
||||
return true
|
||||
}
|
||||
|
||||
res.fail({
|
||||
status: HttpStatusCode.FORBIDDEN_403,
|
||||
message: 'Cannot terminate an ownership change of another user'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
export {
|
||||
checkUserCanTerminateOwnershipChange
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue