Add audit event for ownership transfer

This commit is contained in:
Girish Ramakrishnan
2018-07-05 13:51:22 -07:00
parent 75f9b19db2
commit 6810c61e58
3 changed files with 7 additions and 3 deletions

View File

@@ -645,15 +645,18 @@ function disableTwoFactorAuthentication(userId, callback) {
});
}
function transferOwnership(oldOwnerId, newOwnerId, callback) {
function transferOwnership(oldOwnerId, newOwnerId, auditSource, callback) {
assert.strictEqual(typeof oldOwnerId, 'string');
assert.strictEqual(typeof newOwnerId, 'string');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
apps.transferOwnership(oldOwnerId, newOwnerId, function (error) {
if (error && error.reason === AppsError.NOT_FOUND) return callback(new UsersError(UsersError.NOT_FOUND, error.message));
if (error) return callback(new UsersError(UsersError.INTERNAL_ERROR, error));
eventlog.add(eventlog.ACTION_USER_TRANSFER, auditSource, { oldOwnerId: oldOwnerId, newOwnerId: newOwnerId });
callback(null);
});
}