Skip to content

Commit 98535d6

Browse files
authored
Merge pull request #1386 from nextcloud/backport/1385/stable29
2 parents 06ec325 + 12504b6 commit 98535d6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/Controller/LogController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
use OCA\LogReader\Log\LogIteratorFactory;
2626
use OCA\LogReader\Log\SearchFilter;
2727
use OCA\LogReader\Service\SettingsService;
28+
use OCA\LogReader\Settings\Admin;
2829
use OCP\AppFramework\Controller;
2930
use OCP\AppFramework\Http;
31+
use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
3032
use OCP\AppFramework\Http\JSONResponse;
3133
use OCP\IRequest;
3234
use Psr\Log\LoggerInterface;
@@ -48,12 +50,12 @@ public function __construct($appName,
4850
}
4951

5052
/**
51-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
5253
* @param string $query
5354
* @param int $count
5455
* @param int $offset
5556
* @return JSONResponse
5657
*/
58+
#[AuthorizedAdminSetting(settings: Admin::class)]
5759
public function get($query = '', $count = 50, $offset = 0): JSONResponse {
5860
$logType = $this->settingsService->getLoggingType();
5961
// we only support web access when `log_type` is set to `file` (the default)
@@ -86,7 +88,6 @@ private function getLastItem() {
8688
}
8789

8890
/**
89-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
9091
* @brief Use to poll for new log messages since $lastReqId.
9192
*
9293
* @note There is a possible race condition, when the user loads the
@@ -99,6 +100,7 @@ private function getLastItem() {
99100
* will work in some cases but not when there are more than 50 messages of that
100101
* request.
101102
*/
103+
#[AuthorizedAdminSetting(settings: Admin::class)]
102104
public function poll(string $lastReqId): JSONResponse {
103105
$logType = $this->settingsService->getLoggingType();
104106
// we only support web access when `log_type` is set to `file` (the default)

lib/Controller/SettingsController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727

2828
use OCA\LogReader\Constants;
2929
use OCA\LogReader\Service\SettingsService;
30+
use OCA\LogReader\Settings\Admin;
3031
use OCP\AppFramework\ApiController;
3132
use OCP\AppFramework\Http;
33+
use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
3234
use OCP\AppFramework\Http\JSONResponse;
3335
use OCP\IConfig;
3436
use OCP\IRequest;
@@ -49,9 +51,8 @@ public function __construct(
4951

5052
/**
5153
* Get the current app config
52-
*
53-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
5454
*/
55+
#[AuthorizedAdminSetting(settings: Admin::class)]
5556
public function getAppConfig(): JSONResponse {
5657
return new JSONResponse($this->settingsService->getAppSettings());
5758
}
@@ -62,8 +63,8 @@ public function getAppConfig(): JSONResponse {
6263
* @param string $settingsKey AppConfig Key to store
6364
* @param mixed $settingsValues Corresponding AppConfig Value
6465
*
65-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
6666
*/
67+
#[AuthorizedAdminSetting(settings: Admin::class)]
6768
public function updateAppConfig(string $settingsKey, $settingsValue): JSONResponse {
6869
$this->logger->debug('Updating AppConfig: {settingsKey} => {settingsValue}', [
6970
'settingsKey' => $settingsKey,

0 commit comments

Comments
 (0)