Skip to content
Closed
39 changes: 21 additions & 18 deletions apps/admin_audit/lib/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
use OCA\AdminAudit\IAuditLogger;

class Action {

public function __construct(
private IAuditLogger $logger,
) {}
) {
}

/**
* Log a single action with a log level of info
Expand All @@ -49,23 +49,26 @@ public function log(string $text,
array $elements,
bool $obfuscateParameters = false): void {
foreach ($elements as $element) {
if (!isset($params[$element])) {
if ($obfuscateParameters) {
$this->logger->critical(
'$params["'.$element.'"] was missing.',
['app' => 'admin_audit']
);
} else {
$this->logger->critical(
sprintf(
'$params["'.$element.'"] was missing. Transferred value: %s',
print_r($params, true)
),
['app' => 'admin_audit']
);
}
return;
if (isset($params[$element])) {
continue;
}

if ($obfuscateParameters) {
$this->logger->critical(
'$params["'.$element.'"] was missing.',
['app' => 'admin_audit']
);
} else {
$this->logger->critical(
sprintf(
'$params["'.$element.'"] was missing. Transferred value: %s',
print_r($params, true)
),
['app' => 'admin_audit']
);
}

return;
}

$replaceArray = [];
Expand Down
1 change: 0 additions & 1 deletion apps/admin_audit/lib/Actions/AppManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace OCA\AdminAudit\Actions;

class AppManagement extends Action {

/**
* @param string $appName
*/
Expand Down
1 change: 0 additions & 1 deletion apps/admin_audit/lib/Actions/GroupManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* @package OCA\AdminAudit\Actions
*/
class GroupManagement extends Action {

/**
* log add user to group event
*
Expand Down
Loading