]>
Commit | Line | Data |
---|---|---|
74d63469 | 1 | import { Response } from 'express' |
26d6bf65 | 2 | import { MUserId } from '@server/types/models' |
10363c74 | 3 | import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership' |
2d53be02 | 4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
74d63469 | 5 | |
10363c74 | 6 | function checkUserCanTerminateOwnershipChange (user: MUserId, videoChangeOwnership: MVideoChangeOwnershipFull, res: Response) { |
f41d6aac | 7 | if (videoChangeOwnership.NextOwner.userId === user.id) { |
74d63469 GR |
8 | return true |
9 | } | |
10 | ||
76148b27 RK |
11 | res.fail({ |
12 | status: HttpStatusCode.FORBIDDEN_403, | |
13 | message: 'Cannot terminate an ownership change of another user' | |
14 | }) | |
74d63469 GR |
15 | return false |
16 | } | |
10363c74 C |
17 | |
18 | export { | |
19 | checkUserCanTerminateOwnershipChange | |
20 | } |