diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-19 17:02:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 17:02:27 +0200 |
commit | 993cef4b6e000ee425087e5195dfe40cd0840243 (patch) | |
tree | 9bddf4a2f4fad0ac8cbb9d79445c1c1ec36bd305 /server/controllers/api/videos/index.ts | |
parent | 606c946e74211c4123b16087288902226306198d (diff) | |
download | PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.gz PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.zst PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.zip |
Refractor audit user identifier
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 8353a649a..581046782 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -4,7 +4,7 @@ import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../ | |||
4 | import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 4 | import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
5 | import { processImage } from '../../../helpers/image-utils' | 5 | import { processImage } from '../../../helpers/image-utils' |
6 | import { logger } from '../../../helpers/logger' | 6 | import { logger } from '../../../helpers/logger' |
7 | import { auditLoggerFactory, VideoAuditView } from '../../../helpers/audit-logger' | 7 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
8 | import { getFormattedObjects, getServerActor } from '../../../helpers/utils' | 8 | import { getFormattedObjects, getServerActor } from '../../../helpers/utils' |
9 | import { | 9 | import { |
10 | CONFIG, | 10 | CONFIG, |
@@ -253,7 +253,7 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
253 | 253 | ||
254 | await federateVideoIfNeeded(video, true, t) | 254 | await federateVideoIfNeeded(video, true, t) |
255 | 255 | ||
256 | auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoAuditView(videoCreated.toFormattedDetailsJSON())) | 256 | auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(videoCreated.toFormattedDetailsJSON())) |
257 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) | 257 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) |
258 | 258 | ||
259 | return videoCreated | 259 | return videoCreated |
@@ -354,7 +354,7 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
354 | await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t) | 354 | await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t) |
355 | 355 | ||
356 | auditLogger.update( | 356 | auditLogger.update( |
357 | res.locals.oauth.token.User.Account.Actor.getIdentifier(), | 357 | getAuditIdFromRes(res), |
358 | new VideoAuditView(videoInstanceUpdated.toFormattedDetailsJSON()), | 358 | new VideoAuditView(videoInstanceUpdated.toFormattedDetailsJSON()), |
359 | oldVideoAuditView | 359 | oldVideoAuditView |
360 | ) | 360 | ) |
@@ -439,7 +439,7 @@ async function removeVideo (req: express.Request, res: express.Response) { | |||
439 | await videoInstance.destroy({ transaction: t }) | 439 | await videoInstance.destroy({ transaction: t }) |
440 | }) | 440 | }) |
441 | 441 | ||
442 | auditLogger.delete(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoAuditView(videoInstance.toFormattedDetailsJSON())) | 442 | auditLogger.delete(getAuditIdFromRes(res), new VideoAuditView(videoInstance.toFormattedDetailsJSON())) |
443 | logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid) | 443 | logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid) |
444 | 444 | ||
445 | return res.type('json').status(204).end() | 445 | return res.type('json').status(204).end() |