1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @copyright Copyright (c) 2021 Joas Schilling <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @author Joas Schilling <[email protected]> |
9
|
|
|
* |
10
|
|
|
* @license GNU AGPL version 3 or any later version |
11
|
|
|
* |
12
|
|
|
* This program is free software: you can redistribute it and/or modify |
13
|
|
|
* it under the terms of the GNU Affero General Public License as |
14
|
|
|
* published by the Free Software Foundation, either version 3 of the |
15
|
|
|
* License, or (at your option) any later version. |
16
|
|
|
* |
17
|
|
|
* This program is distributed in the hope that it will be useful, |
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20
|
|
|
* GNU Affero General Public License for more details. |
21
|
|
|
* |
22
|
|
|
* You should have received a copy of the GNU Affero General Public License |
23
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
24
|
|
|
* |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace OCP\Log\Audit; |
28
|
|
|
|
29
|
|
|
use OCP\EventDispatcher\Event; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Emitted when the admin_audit app should log an entry |
33
|
|
|
* |
34
|
|
|
* @since 22.0.0 |
35
|
|
|
*/ |
36
|
|
|
class CriticalActionPerformedEvent extends Event { |
37
|
|
|
|
38
|
|
|
/** @var string */ |
39
|
|
|
private $logMessage; |
40
|
|
|
|
41
|
|
|
/** @var array */ |
42
|
|
|
private $parameters; |
43
|
|
|
|
44
|
|
|
/** @var bool */ |
45
|
|
|
private $obfuscateParameters; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param string $logMessage |
49
|
|
|
* @param array $parameters |
50
|
|
|
* @param bool $obfuscateParameters |
51
|
|
|
* @since 22.0.0 |
52
|
|
|
*/ |
53
|
|
|
public function __construct(string $logMessage, |
54
|
|
|
array $parameters = [], |
55
|
|
|
bool $obfuscateParameters = false) { |
56
|
|
|
parent::__construct(); |
57
|
|
|
$this->logMessage = $logMessage; |
58
|
|
|
$this->parameters = $parameters; |
59
|
|
|
$this->obfuscateParameters = $obfuscateParameters; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return string |
64
|
|
|
* @since 22.0.0 |
65
|
|
|
*/ |
66
|
|
|
public function getLogMessage(): string { |
67
|
|
|
return $this->logMessage; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return array |
72
|
|
|
* @since 22.0.0 |
73
|
|
|
*/ |
74
|
|
|
public function getParameters(): array { |
75
|
|
|
return $this->parameters; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return bool |
80
|
|
|
* @since 22.0.0 |
81
|
|
|
*/ |
82
|
|
|
public function getObfuscateParameters(): bool { |
83
|
|
|
return $this->obfuscateParameters; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|