mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-06 16:36:59 +01:00
* [ADD] Syslog and remote syslog through Monolog
* [MOD] UI tweaks
This commit is contained in:
@@ -28,6 +28,12 @@ $public-path: '../../../../../../public';
|
||||
box-shadow: 0 -3px 2px -2px rgba(0, 0, 0, 0.14);
|
||||
}
|
||||
|
||||
@mixin box-shadow-top-white() {
|
||||
-webkit-box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25);
|
||||
-moz-box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25);
|
||||
box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
|
||||
@mixin border-radius($radius) {
|
||||
border-radius: $radius !important;
|
||||
-moz-border-radius: $radius !important;
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
body.login, body.logout {
|
||||
background-color: $color-bluegrey-fg;
|
||||
background: $color-bluegrey-fg;
|
||||
#wrap {
|
||||
background-color: $color-bluegrey-fg;
|
||||
background: transparent;
|
||||
}
|
||||
footer {
|
||||
background: $color-bluegrey-fg;
|
||||
color: #c9c9c9;
|
||||
@include box-shadow-top-white();
|
||||
}
|
||||
}
|
||||
|
||||
#login-logo {
|
||||
position: fixed;
|
||||
top: 1em;
|
||||
right: 1em;
|
||||
left: 1em;
|
||||
width: 100%;
|
||||
height: 8em;
|
||||
background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top right;
|
||||
background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top left;
|
||||
background-size: auto 8em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,17 +1060,23 @@ fieldset.warning {
|
||||
opacity: .5 !important; }
|
||||
|
||||
body.login, body.logout {
|
||||
background-color: #607d8b; }
|
||||
background: #607d8b; }
|
||||
body.login #wrap, body.logout #wrap {
|
||||
background-color: #607d8b; }
|
||||
background: transparent; }
|
||||
body.login footer, body.logout footer {
|
||||
background: #607d8b;
|
||||
color: #c9c9c9;
|
||||
-webkit-box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25);
|
||||
-moz-box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25);
|
||||
box-shadow: 0 -3px 2px -2px rgba(255, 255, 255, 0.25); }
|
||||
|
||||
#login-logo {
|
||||
position: fixed;
|
||||
top: 1em;
|
||||
right: 1em;
|
||||
left: 1em;
|
||||
width: 100%;
|
||||
height: 8em;
|
||||
background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top right;
|
||||
background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top left;
|
||||
background-size: auto 8em; }
|
||||
|
||||
#login-container {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
127
composer.lock
generated
127
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "89e0d45720cfbc9674a139eb6fcfd108",
|
||||
"content-hash": "5fa453967b9cc7315f0c41842bfbe985",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ademarre/binary-to-text-php",
|
||||
@@ -781,6 +781,84 @@
|
||||
],
|
||||
"time": "2017-02-01T23:08:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.23.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"jakub-onderka/php-parallel-lint": "0.9",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"phpunit/phpunit-mock-objects": "2.3.0",
|
||||
"ruflin/elastica": ">=0.90 <3.0",
|
||||
"sentry/sentry": "^0.13",
|
||||
"swiftmailer/swiftmailer": "^5.3|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "http://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2017-06-19T01:22:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v2.0.11",
|
||||
@@ -1229,6 +1307,53 @@
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "roave/security-advisories",
|
||||
"version": "dev-master",
|
||||
|
||||
@@ -57,5 +57,7 @@ return [
|
||||
\SP\Core\UI\Theme::class => object(\SP\Core\UI\Theme::class)
|
||||
->constructor(APP_MODULE, get(\SP\Config\Config::class), get(\SP\Core\Context\ContextInterface::class)),
|
||||
\PHPMailer\PHPMailer\PHPMailer::class => object(\PHPMailer\PHPMailer\PHPMailer::class)
|
||||
->constructor(true)
|
||||
->constructor(true),
|
||||
\Monolog\Logger::class => object(\Monolog\Logger::class)
|
||||
->constructor('syspass')
|
||||
];
|
||||
@@ -187,11 +187,12 @@ class EventMessage implements MessageInterface
|
||||
/**
|
||||
* Componer un mensaje en formato texto
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public function composeText()
|
||||
public function composeText($delimiter = PHP_EOL)
|
||||
{
|
||||
return implode(PHP_EOL, [$this->getDescription(true), $this->getDetails(true)]);
|
||||
return implode($delimiter, [$this->getDescription(true), $this->getDetails(true)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +216,7 @@ class EventMessage implements MessageInterface
|
||||
* Devolver un detalle formateado
|
||||
*
|
||||
* @param array $detail
|
||||
* @param bool $translate
|
||||
* @param bool $translate
|
||||
* @return string
|
||||
*/
|
||||
protected function formatDetail(array $detail, $translate = false)
|
||||
@@ -291,7 +292,7 @@ class EventMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param mixed $data
|
||||
* @param mixed $data
|
||||
* @return EventMessage
|
||||
*/
|
||||
public function addData($type, $data)
|
||||
|
||||
@@ -58,10 +58,11 @@ class MailMessage extends MessageBase implements MessageInterface
|
||||
/**
|
||||
* Componer un mensaje en formato texto
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public function composeText()
|
||||
public function composeText($delimiter = PHP_EOL)
|
||||
{
|
||||
return $this->title . PHP_EOL . implode(PHP_EOL, $this->description) . PHP_EOL . implode(PHP_EOL, $this->footer);
|
||||
return $this->title . $delimiter . implode($delimiter, $this->description) . $delimiter . implode($delimiter, $this->footer);
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,10 @@ interface MessageInterface
|
||||
/**
|
||||
* Componer un mensaje en formato texto
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public function composeText();
|
||||
public function composeText($delimiter = PHP_EOL);
|
||||
|
||||
/**
|
||||
* Componer un mensaje en formato HTML
|
||||
|
||||
@@ -50,10 +50,11 @@ class NoticeMessage extends MessageBase
|
||||
/**
|
||||
* Componer un mensaje en formato texto
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public function composeText()
|
||||
public function composeText($delimiter = PHP_EOL)
|
||||
{
|
||||
return $this->title . PHP_EOL . implode(PHP_EOL, $this->description) . PHP_EOL . implode(PHP_EOL, $this->footer);
|
||||
return $this->title . $delimiter . implode($delimiter, $this->description) . $delimiter . implode($delimiter, $this->footer);
|
||||
}
|
||||
}
|
||||
@@ -168,11 +168,12 @@ class TaskMessage implements MessageInterface, JsonSerializable
|
||||
/**
|
||||
* Componer un mensaje en formato texto
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public function composeText()
|
||||
public function composeText($delimiter = ';')
|
||||
{
|
||||
return implode(';', [
|
||||
return implode($delimiter, [
|
||||
'taskId' => $this->taskId,
|
||||
'task' => $this->task,
|
||||
'message' => $this->message,
|
||||
|
||||
@@ -31,6 +31,8 @@ use SP\Config\Config;
|
||||
use SP\Core\Context\ContextInterface;
|
||||
use SP\Core\Events\EventDispatcher;
|
||||
use SP\Providers\Log\LogHandler;
|
||||
use SP\Providers\Log\RemoteSyslogHandler;
|
||||
use SP\Providers\Log\SyslogHandler;
|
||||
use SP\Providers\Mail\MailHandler;
|
||||
use SP\Providers\Notification\NotificationHandler;
|
||||
use SP\Util\Checks;
|
||||
@@ -123,6 +125,14 @@ abstract class ModuleBase
|
||||
$eventDispatcher->attach($this->container->get(MailHandler::class));
|
||||
}
|
||||
|
||||
if ($this->configData->isSyslogEnabled()) {
|
||||
$eventDispatcher->attach($this->container->get(SyslogHandler::class));
|
||||
}
|
||||
|
||||
if ($this->configData->isSyslogRemoteEnabled()) {
|
||||
$eventDispatcher->attach($this->container->get(RemoteSyslogHandler::class));
|
||||
}
|
||||
|
||||
$eventDispatcher->attach($this->container->get(NotificationHandler::class));
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
namespace SP\Providers\Log;
|
||||
|
||||
use Monolog\Handler\SyslogHandler;
|
||||
use Monolog\Logger;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventReceiver;
|
||||
use SP\DataModel\EventlogData;
|
||||
@@ -101,7 +103,7 @@ class LogHandler extends Provider implements EventReceiver
|
||||
* Evento de actualización
|
||||
*
|
||||
* @param string $eventType Nombre del evento
|
||||
* @param Event $event Objeto del evento
|
||||
* @param Event $event Objeto del evento
|
||||
*/
|
||||
public function updateEvent($eventType, Event $event)
|
||||
{
|
||||
@@ -144,6 +146,28 @@ class LogHandler extends Provider implements EventReceiver
|
||||
return self::EVENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $eventType
|
||||
* @param Event $event
|
||||
*/
|
||||
protected function sendToSyslog($eventType, Event $event)
|
||||
{
|
||||
$logger = $this->dic->get(Logger::class);
|
||||
$logger->pushHandler(new SyslogHandler('syspass'));
|
||||
$logger->info($eventType . ';' . $event->getEventMessage()->composeText(';'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $eventType
|
||||
* @param Event $event
|
||||
*/
|
||||
protected function sendToRemoteSyslog($eventType, Event $event)
|
||||
{
|
||||
$logger = $this->dic->get(Logger::class);
|
||||
$logger->pushHandler(new SyslogHandler('syspass'));
|
||||
$logger->info($eventType . ';' . $event->getEventMessage()->composeText(';'));
|
||||
}
|
||||
|
||||
protected function initialize()
|
||||
{
|
||||
$this->eventlogService = $this->dic->get(EventlogService::class);
|
||||
|
||||
153
lib/SP/Providers/Log/RemoteSyslogHandler.php
Normal file
153
lib/SP/Providers/Log/RemoteSyslogHandler.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Providers\Log;
|
||||
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Logger;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventReceiver;
|
||||
use SP\Providers\EventsTrait;
|
||||
use SP\Providers\Provider;
|
||||
use SplSubject;
|
||||
|
||||
/**
|
||||
* Class RemoteSyslogHandler
|
||||
* @package SP\Providers\Log
|
||||
*/
|
||||
class RemoteSyslogHandler extends Provider implements EventReceiver
|
||||
{
|
||||
use EventsTrait;
|
||||
|
||||
const EVENTS = [
|
||||
'create.',
|
||||
'delete.',
|
||||
'edit.',
|
||||
'exception',
|
||||
'save.',
|
||||
'show.account.pass',
|
||||
'show.account.link',
|
||||
'copy.account.pass',
|
||||
'clear.eventlog',
|
||||
'login.',
|
||||
'logout',
|
||||
'track.',
|
||||
'acl.deny',
|
||||
'check.tempMasterPassword',
|
||||
'expire.tempMasterPassword',
|
||||
'refresh.masterPassword',
|
||||
'update.',
|
||||
'import.ldap.',
|
||||
'run.',
|
||||
'send.mail',
|
||||
'show.authToken'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $events;
|
||||
/**
|
||||
* @var Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Inicialización del observador
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
// TODO: Implement init() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Evento de actualización
|
||||
*
|
||||
* @param string $eventType Nombre del evento
|
||||
* @param Event $event Objeto del evento
|
||||
*/
|
||||
public function updateEvent($eventType, Event $event)
|
||||
{
|
||||
$this->logger->debug($eventType . ';' . $event->getEventMessage()->composeText(';'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve los eventos que implementa el observador
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEvents()
|
||||
{
|
||||
return self::EVENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve los eventos que implementa el observador en formato cadena
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEventsString()
|
||||
{
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive update from subject
|
||||
* @link http://php.net/manual/en/splobserver.update.php
|
||||
* @param SplSubject $subject <p>
|
||||
* The <b>SplSubject</b> notifying the observer of an update.
|
||||
* </p>
|
||||
* @return void
|
||||
* @since 5.1.0
|
||||
*/
|
||||
public function update(SplSubject $subject)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
}
|
||||
|
||||
protected function initialize()
|
||||
{
|
||||
$configData = $this->config->getConfigData();
|
||||
|
||||
$this->logger = $this->dic->get(Logger::class)
|
||||
->pushHandler(
|
||||
new SyslogUdpHandler(
|
||||
$configData->getSyslogServer(),
|
||||
$configData->getSyslogPort(),
|
||||
LOG_USER,
|
||||
Logger::DEBUG,
|
||||
true,
|
||||
'syspass'
|
||||
)
|
||||
);
|
||||
|
||||
$configEvents = $configData->getLogEvents();
|
||||
|
||||
if (count($configEvents) === 0) {
|
||||
$this->events = $this->parseEventsToRegex(self::EVENTS);
|
||||
} else {
|
||||
$this->events = $this->parseEventsToRegex($configEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
141
lib/SP/Providers/Log/SyslogHandler.php
Normal file
141
lib/SP/Providers/Log/SyslogHandler.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Providers\Log;
|
||||
|
||||
use Monolog\Logger;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventReceiver;
|
||||
use SP\Providers\EventsTrait;
|
||||
use SP\Providers\Provider;
|
||||
use SplSubject;
|
||||
|
||||
/**
|
||||
* Class SyslogHandler
|
||||
* @package SP\Providers\Log
|
||||
*/
|
||||
class SyslogHandler extends Provider implements EventReceiver
|
||||
{
|
||||
use EventsTrait;
|
||||
|
||||
const EVENTS = [
|
||||
'create.',
|
||||
'delete.',
|
||||
'edit.',
|
||||
'exception',
|
||||
'save.',
|
||||
'show.account.pass',
|
||||
'show.account.link',
|
||||
'copy.account.pass',
|
||||
'clear.eventlog',
|
||||
'login.',
|
||||
'logout',
|
||||
'track.',
|
||||
'acl.deny',
|
||||
'check.tempMasterPassword',
|
||||
'expire.tempMasterPassword',
|
||||
'refresh.masterPassword',
|
||||
'update.',
|
||||
'import.ldap.',
|
||||
'run.',
|
||||
'send.mail',
|
||||
'show.authToken'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $events;
|
||||
/**
|
||||
* @var Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Inicialización del observador
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
// TODO: Implement init() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Evento de actualización
|
||||
*
|
||||
* @param string $eventType Nombre del evento
|
||||
* @param Event $event Objeto del evento
|
||||
*/
|
||||
public function updateEvent($eventType, Event $event)
|
||||
{
|
||||
$this->logger->debug($eventType . ';' . $event->getEventMessage()->composeText(';'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve los eventos que implementa el observador
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEvents()
|
||||
{
|
||||
return self::EVENTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve los eventos que implementa el observador en formato cadena
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEventsString()
|
||||
{
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive update from subject
|
||||
* @link http://php.net/manual/en/splobserver.update.php
|
||||
* @param SplSubject $subject <p>
|
||||
* The <b>SplSubject</b> notifying the observer of an update.
|
||||
* </p>
|
||||
* @return void
|
||||
* @since 5.1.0
|
||||
*/
|
||||
public function update(SplSubject $subject)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
}
|
||||
|
||||
protected function initialize()
|
||||
{
|
||||
$this->logger = $this->dic->get(Logger::class)
|
||||
->pushHandler(new \Monolog\Handler\SyslogHandler('syspass'));
|
||||
|
||||
$configEvents = $this->config->getConfigData()->getLogEvents();
|
||||
|
||||
if (count($configEvents) === 0) {
|
||||
$this->events = $this->parseEventsToRegex(self::EVENTS);
|
||||
} else {
|
||||
$this->events = $this->parseEventsToRegex($configEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user