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/helpers/audit-logger.ts | |
parent | 606c946e74211c4123b16087288902226306198d (diff) | |
download | PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.gz PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.zst PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.zip |
Refractor audit user identifier
Diffstat (limited to 'server/helpers/audit-logger.ts')
-rw-r--r-- | server/helpers/audit-logger.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index 7db72b69c..00311fce1 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as path from 'path' | 1 | import * as path from 'path' |
2 | import * as express from 'express' | ||
2 | import { diff } from 'deep-object-diff' | 3 | import { diff } from 'deep-object-diff' |
3 | import { chain } from 'lodash' | 4 | import { chain } from 'lodash' |
4 | import * as flatten from 'flat' | 5 | import * as flatten from 'flat' |
@@ -8,6 +9,11 @@ import { jsonLoggerFormat, labelFormatter } from './logger' | |||
8 | import { VideoDetails, User, VideoChannel, VideoAbuse, VideoImport } from '../../shared' | 9 | import { VideoDetails, User, VideoChannel, VideoAbuse, VideoImport } from '../../shared' |
9 | import { VideoComment } from '../../shared/models/videos/video-comment.model' | 10 | import { VideoComment } from '../../shared/models/videos/video-comment.model' |
10 | import { CustomConfig } from '../../shared/models/server/custom-config.model' | 11 | import { CustomConfig } from '../../shared/models/server/custom-config.model' |
12 | import { UserModel } from '../models/account/user' | ||
13 | |||
14 | function getAuditIdFromRes (res: express.Response) { | ||
15 | return (res.locals.oauth.token.User as UserModel).username | ||
16 | } | ||
11 | 17 | ||
12 | enum AUDIT_TYPE { | 18 | enum AUDIT_TYPE { |
13 | CREATE = 'create', | 19 | CREATE = 'create', |
@@ -255,6 +261,8 @@ class CustomConfigAuditView extends EntityAuditView { | |||
255 | } | 261 | } |
256 | 262 | ||
257 | export { | 263 | export { |
264 | getAuditIdFromRes, | ||
265 | |||
258 | auditLoggerFactory, | 266 | auditLoggerFactory, |
259 | VideoImportAuditView, | 267 | VideoImportAuditView, |
260 | VideoChannelAuditView, | 268 | VideoChannelAuditView, |