Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor admin audit app #39192

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)
danialRahimy marked this conversation as resolved.
Show resolved Hide resolved
),
['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