mirror of
https://github.com/nextcloud/server.git
synced 2026-11-26 16:15:53 +01:00
Audit entries are added for app password creation, deletion and scope changes, remote wipe requests, WebAuthn devices, two-factor enforcement, mail server settings and credentials, admin delegation, presets, declarative settings and log file downloads. The existing AI settings entry keeps its message and now carries an operation (settings.ai.updated) and named parameters. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
namespace OCA\Settings\Controller;
|
|
|
|
use OC\Log;
|
|
use OCP\AppFramework\Controller;
|
|
use OCP\AppFramework\Http;
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
|
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
|
use OCP\AppFramework\Http\StreamResponse;
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
|
use OCP\IRequest;
|
|
use OCP\Log\Audit\CriticalActionPerformedEvent;
|
|
|
|
class LogSettingsController extends Controller {
|
|
|
|
public function __construct(
|
|
string $appName,
|
|
IRequest $request,
|
|
private Log $log,
|
|
private IEventDispatcher $eventDispatcher,
|
|
) {
|
|
parent::__construct($appName, $request);
|
|
}
|
|
|
|
/**
|
|
* download logfile
|
|
*
|
|
* @return StreamResponse<Http::STATUS_OK, array{Content-Type: 'application/octet-stream', 'Content-Disposition': 'attachment; filename="nextcloud.log"'}>
|
|
*
|
|
* 200: Logfile returned
|
|
*/
|
|
#[NoCSRFRequired]
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION)]
|
|
public function download() {
|
|
if (!$this->log instanceof Log) {
|
|
throw new \UnexpectedValueException('Log file not available');
|
|
}
|
|
$this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent(
|
|
'Log file was downloaded',
|
|
[],
|
|
false,
|
|
'settings.log.downloaded',
|
|
));
|
|
return new StreamResponse(
|
|
$this->log->getLogPath(),
|
|
Http::STATUS_OK,
|
|
[
|
|
'Content-Type' => 'application/octet-stream',
|
|
'Content-Disposition' => 'attachment; filename="nextcloud.log"',
|
|
],
|
|
);
|
|
}
|
|
}
|