various minor fixes to eventlog
This commit is contained in:
+3
-3
@@ -424,7 +424,7 @@ function install(appId, appStoreId, manifest, location, portBindings, accessRest
|
||||
|
||||
taskmanager.restartAppTask(appId);
|
||||
|
||||
eventlog.add(eventlog.ACTION_APP_INSTALL, auditSource, { appId: appId, location: location, appStoreId: appStoreId, version: manifest.version });
|
||||
eventlog.add(eventlog.ACTION_APP_INSTALL, auditSource, { appId: appId, location: location, manifest: manifest });
|
||||
|
||||
callback(null);
|
||||
});
|
||||
@@ -498,7 +498,7 @@ function configure(appId, location, portBindings, accessRestriction, cert, key,
|
||||
|
||||
taskmanager.restartAppTask(appId);
|
||||
|
||||
eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId: appId, oldLocation: app.location });
|
||||
eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId: appId });
|
||||
|
||||
callback(null);
|
||||
});
|
||||
@@ -572,7 +572,7 @@ function update(appId, force, manifest, portBindings, icon, auditSource, callbac
|
||||
|
||||
taskmanager.restartAppTask(appId);
|
||||
|
||||
eventlog.add(eventlog.ACTION_APP_UPDATE, auditSource, { appId: appId, appStoreId: manifest.id, toVersion: manifest.version, fromVersion: app.manifest.version });
|
||||
eventlog.add(eventlog.ACTION_APP_UPDATE, auditSource, { appId: appId, toManifest: manifest, fromManifest: app.manifest });
|
||||
|
||||
callback(null);
|
||||
});
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ function autoRenew(callback) {
|
||||
var keyFilePath = path.join(paths.APP_CERTS_DIR, domain + '.key');
|
||||
|
||||
var errorMessage = error ? error.message : '';
|
||||
eventlog.add(eventlog.ACTION_CERTIFICATE_RENEWAL, { userId: null, username: 'cron' }, { domain: domain, error: errorMessage });
|
||||
eventlog.add(eventlog.ACTION_CERTIFICATE_RENEWAL, { userId: null, username: 'cron' }, { domain: domain, errorMessage: errorMessage });
|
||||
mailer.certificateRenewed(domain, errorMessage);
|
||||
|
||||
if (error) {
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ function start(callback) {
|
||||
// we return no such object, to avoid leakage of a users existence
|
||||
if (!result) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, { authType: 'ldap',appId: app.id, location: app.location }, { userId: userObject.id, username: userObject.username, appId: app.id });
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, { authType: 'ldap', appId: app.id }, { userId: userObject.id });
|
||||
|
||||
res.end();
|
||||
});
|
||||
|
||||
@@ -23,9 +23,9 @@ var appdb = require('../appdb'),
|
||||
UserError = user.UserError,
|
||||
util = require('util');
|
||||
|
||||
function auditSource(req) {
|
||||
function auditSource(req, appId) {
|
||||
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress || null;
|
||||
return { authType: 'oauth', ip: ip, username: req.user ? req.user.username : null, userId: req.user ? req.user.id : null };
|
||||
return { authType: 'oauth', ip: ip, appId: appId };
|
||||
}
|
||||
|
||||
// create OAuth 2.0 server
|
||||
@@ -415,7 +415,7 @@ var authorization = [
|
||||
var type = req.oauth2.client.type;
|
||||
|
||||
if (type === clientdb.TYPE_ADMIN) {
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req), { userId: req.oauth2.user.id, username: req.oauth2.user.username, appId: 'admin' });
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req, 'admin'), { userId: req.oauth2.user.id });
|
||||
return next();
|
||||
}
|
||||
if (type === clientdb.TYPE_EXTERNAL) return next();
|
||||
@@ -428,7 +428,7 @@ var authorization = [
|
||||
if (error) return sendError(req, res, 'Internal error');
|
||||
if (!access) return sendErrorPageOrRedirect(req, res, 'No access to this app.');
|
||||
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req), { userId: req.oauth2.user.id, username: req.oauth2.user.username, appId: appObject.id, appLocation: appObject.location });
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req, appObject.id), { userId: req.oauth2.user.id });
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ function login(req, res, next) {
|
||||
if (error && error.reason === AppsError.ACCESS_DENIED) return next(new HttpError(401, 'Forbidden'));
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, { authType: 'simpleauth', clientId: req.body.clientId }, { userId: result.user.id, username: result.user.username });
|
||||
eventlog.add(eventlog.ACTION_USER_LOGIN, { authType: 'simpleauth', clientId: req.body.clientId }, { userId: result.user.id });
|
||||
|
||||
var tmp = {
|
||||
accessToken: result.accessToken,
|
||||
|
||||
+1
-1
@@ -328,7 +328,7 @@ function updateUser(userId, username, email, displayName, auditSource, callback)
|
||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND, error));
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
eventlog.add(eventlog.ACTION_USER_UPDATE, auditSource, { userId: userId, username: username });
|
||||
eventlog.add(eventlog.ACTION_USER_UPDATE, auditSource, { userId: userId });
|
||||
|
||||
callback(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user