/** * Add a user entry to the audit log * * @param Events\UserEvent $event */ public function onUserPostSave(Events\UserEvent $event) { $user = $event->getUser(); if ($details = $event->getChanges()) { $log = array("bundle" => "user", "object" => "user", "objectId" => $user->getId(), "action" => $event->isNew() ? "create" : "update", "details" => $details, "ipAddress" => $this->factory->getIpAddressFromRequest()); $this->factory->getModel('core.auditLog')->writeToLog($log); } }
/** * Add a user entry to the audit log. * * @param Events\UserEvent $event */ public function onUserPostSave(Events\UserEvent $event) { $user = $event->getUser(); if ($details = $event->getChanges()) { $log = ['bundle' => 'user', 'object' => 'user', 'objectId' => $user->getId(), 'action' => $event->isNew() ? 'create' : 'update', 'details' => $details, 'ipAddress' => $this->ipLookupHelper->getIpAddressFromRequest()]; $this->auditLogModel->writeToLog($log); } }