diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-04-13 09:52:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 09:52:08 +0300 |
commit | 421914b4d0ac3b13250d08292f98fdf44e7c60ba (patch) | |
tree | 7a4442c3f5b5a2b5ba103e4f08ae54394af02706 /lib | |
parent | bab06b9abb2a135dc9c3146e027c74c3c80c8593 (diff) | |
parent | 6d502041e07f93ad4a17db69dc5dd0befae0e930 (diff) |
Merge pull request #26467 from nextcloud/feature/noid/allow-apps-to-log-to-audit
Allow apps to log actions into the audit_log
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/public/Log/Audit/CriticalActionPerformedEvent.php | 85 |
3 files changed, 87 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index ebb36e48ea8..3033c0f69e5 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -422,6 +422,7 @@ return array( 'OCP\\Lock\\LockedException' => $baseDir . '/lib/public/Lock/LockedException.php', 'OCP\\Lock\\ManuallyLockedException' => $baseDir . '/lib/public/Lock/ManuallyLockedException.php', 'OCP\\Lockdown\\ILockdownManager' => $baseDir . '/lib/public/Lockdown/ILockdownManager.php', + 'OCP\\Log\\Audit\\CriticalActionPerformedEvent' => $baseDir . '/lib/public/Log/Audit/CriticalActionPerformedEvent.php', 'OCP\\Log\\IDataLogger' => $baseDir . '/lib/public/Log/IDataLogger.php', 'OCP\\Log\\IFileBased' => $baseDir . '/lib/public/Log/IFileBased.php', 'OCP\\Log\\ILogFactory' => $baseDir . '/lib/public/Log/ILogFactory.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 185f6fafa17..dafae4aa46e 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -451,6 +451,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Lock\\LockedException' => __DIR__ . '/../../..' . '/lib/public/Lock/LockedException.php', 'OCP\\Lock\\ManuallyLockedException' => __DIR__ . '/../../..' . '/lib/public/Lock/ManuallyLockedException.php', 'OCP\\Lockdown\\ILockdownManager' => __DIR__ . '/../../..' . '/lib/public/Lockdown/ILockdownManager.php', + 'OCP\\Log\\Audit\\CriticalActionPerformedEvent' => __DIR__ . '/../../..' . '/lib/public/Log/Audit/CriticalActionPerformedEvent.php', 'OCP\\Log\\IDataLogger' => __DIR__ . '/../../..' . '/lib/public/Log/IDataLogger.php', 'OCP\\Log\\IFileBased' => __DIR__ . '/../../..' . '/lib/public/Log/IFileBased.php', 'OCP\\Log\\ILogFactory' => __DIR__ . '/../../..' . '/lib/public/Log/ILogFactory.php', diff --git a/lib/public/Log/Audit/CriticalActionPerformedEvent.php b/lib/public/Log/Audit/CriticalActionPerformedEvent.php new file mode 100644 index 00000000000..98e46757b93 --- /dev/null +++ b/lib/public/Log/Audit/CriticalActionPerformedEvent.php @@ -0,0 +1,85 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2021 Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Log\Audit; + +use OCP\EventDispatcher\Event; + +/** + * Emitted when the admin_audit app should log an entry + * + * @since 22.0.0 + */ +class CriticalActionPerformedEvent extends Event { + + /** @var string */ + private $logMessage; + + /** @var array */ + private $parameters; + + /** @var bool */ + private $obfuscateParameters; + + /** + * @param string $logMessage + * @param array $parameters + * @param bool $obfuscateParameters + * @since 22.0.0 + */ + public function __construct(string $logMessage, + array $parameters = [], + bool $obfuscateParameters = false) { + parent::__construct(); + $this->logMessage = $logMessage; + $this->parameters = $parameters; + $this->obfuscateParameters = $obfuscateParameters; + } + + /** + * @return string + * @since 22.0.0 + */ + public function getLogMessage(): string { + return $this->logMessage; + } + + /** + * @return array + * @since 22.0.0 + */ + public function getParameters(): array { + return $this->parameters; + } + + /** + * @return bool + * @since 22.0.0 + */ + public function getObfuscateParameters(): bool { + return $this->obfuscateParameters; + } +} |