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/config.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/config.ts')
-rw-r--r-- | server/controllers/api/config.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 6edbe4820..95549b724 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -8,7 +8,7 @@ import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers' | |||
8 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' | 8 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' |
9 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' | 9 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' |
10 | import { ClientHtml } from '../../lib/client-html' | 10 | import { ClientHtml } from '../../lib/client-html' |
11 | import { auditLoggerFactory, CustomConfigAuditView } from '../../helpers/audit-logger' | 11 | import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' |
12 | import { remove, writeJSON } from 'fs-extra' | 12 | import { remove, writeJSON } from 'fs-extra' |
13 | 13 | ||
14 | const packageJSON = require('../../../../package.json') | 14 | const packageJSON = require('../../../../package.json') |
@@ -134,10 +134,7 @@ async function getCustomConfig (req: express.Request, res: express.Response, nex | |||
134 | async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 134 | async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
135 | await remove(CONFIG.CUSTOM_FILE) | 135 | await remove(CONFIG.CUSTOM_FILE) |
136 | 136 | ||
137 | auditLogger.delete( | 137 | auditLogger.delete(getAuditIdFromRes(res), new CustomConfigAuditView(customConfig())) |
138 | res.locals.oauth.token.User.Account.Actor.getIdentifier(), | ||
139 | new CustomConfigAuditView(customConfig()) | ||
140 | ) | ||
141 | 138 | ||
142 | reloadConfig() | 139 | reloadConfig() |
143 | ClientHtml.invalidCache() | 140 | ClientHtml.invalidCache() |
@@ -183,7 +180,7 @@ async function updateCustomConfig (req: express.Request, res: express.Response, | |||
183 | const data = customConfig() | 180 | const data = customConfig() |
184 | 181 | ||
185 | auditLogger.update( | 182 | auditLogger.update( |
186 | res.locals.oauth.token.User.Account.Actor.getIdentifier(), | 183 | getAuditIdFromRes(res), |
187 | new CustomConfigAuditView(data), | 184 | new CustomConfigAuditView(data), |
188 | oldCustomConfigAuditKeys | 185 | oldCustomConfigAuditKeys |
189 | ) | 186 | ) |