aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/config.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 17:02:16 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 17:02:27 +0200
commit993cef4b6e000ee425087e5195dfe40cd0840243 (patch)
tree9bddf4a2f4fad0ac8cbb9d79445c1c1ec36bd305 /server/controllers/api/config.ts
parent606c946e74211c4123b16087288902226306198d (diff)
downloadPeerTube-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.ts9
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'
8import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' 8import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
9import { customConfigUpdateValidator } from '../../middlewares/validators/config' 9import { customConfigUpdateValidator } from '../../middlewares/validators/config'
10import { ClientHtml } from '../../lib/client-html' 10import { ClientHtml } from '../../lib/client-html'
11import { auditLoggerFactory, CustomConfigAuditView } from '../../helpers/audit-logger' 11import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
12import { remove, writeJSON } from 'fs-extra' 12import { remove, writeJSON } from 'fs-extra'
13 13
14const packageJSON = require('../../../../package.json') 14const packageJSON = require('../../../../package.json')
@@ -134,10 +134,7 @@ async function getCustomConfig (req: express.Request, res: express.Response, nex
134async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 134async 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 )