Files
cloudron-box/src/auditsource.js

17 lines
610 B
JavaScript
Raw Normal View History

2019-03-25 14:53:12 -07:00
'use strict';
exports = module.exports = {
2019-03-25 15:07:06 -07:00
CRON: { userId: null, username: 'cron' },
HEALTH_MONITOR: { userId: null, username: 'healthmonitor' },
APP_TASK: { userId: null, username: 'apptask' },
EXTERNAL_LDAP_TASK: { userId: null, username: 'externalldap' },
EXTERNAL_LDAP_AUTO_CREATE: { userId: null, username: 'externalldap' },
2019-03-25 15:07:06 -07:00
fromRequest: fromRequest
2019-03-25 14:53:12 -07:00
};
2019-03-25 15:07:06 -07:00
function fromRequest(req) {
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress || null;
return { ip: ip, username: req.user ? req.user.username : null, userId: req.user ? req.user.id : null };
}