Skip to content

Commit b773296

Browse files
Merge pull request #1385 from nextcloud/jtr/refactor-deprecated-sec-annotations
2 parents 36db06b + 88286bc commit b773296

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
@@ -9,8 +9,10 @@
99
use OCA\LogReader\Log\LogIteratorFactory;
1010
use OCA\LogReader\Log\SearchFilter;
1111
use OCA\LogReader\Service\SettingsService;
12+
use OCA\LogReader\Settings\Admin;
1213
use OCP\AppFramework\Controller;
1314
use OCP\AppFramework\Http;
15+
use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
1416
use OCP\AppFramework\Http\JSONResponse;
1517
use OCP\IRequest;
1618
use Psr\Log\LoggerInterface;
@@ -32,12 +34,12 @@ public function __construct($appName,
3234
}
3335

3436
/**
35-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
3637
* @param string $query
3738
* @param int $count
3839
* @param int $offset
3940
* @return JSONResponse
4041
*/
42+
#[AuthorizedAdminSetting(settings: Admin::class)]
4143
public function get($query = '', $count = 50, $offset = 0): JSONResponse {
4244
$logType = $this->settingsService->getLoggingType();
4345
// we only support web access when `log_type` is set to `file` (the default)
@@ -70,7 +72,6 @@ private function getLastItem() {
7072
}
7173

7274
/**
73-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
7475
* @brief Use to poll for new log messages since $lastReqId.
7576
*
7677
* @note There is a possible race condition, when the user loads the
@@ -83,6 +84,7 @@ private function getLastItem() {
8384
* will work in some cases but not when there are more than 50 messages of that
8485
* request.
8586
*/
87+
#[AuthorizedAdminSetting(settings: Admin::class)]
8688
public function poll(string $lastReqId): JSONResponse {
8789
$logType = $this->settingsService->getLoggingType();
8890
// 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
@@ -9,8 +9,10 @@
99

1010
use OCA\LogReader\Constants;
1111
use OCA\LogReader\Service\SettingsService;
12+
use OCA\LogReader\Settings\Admin;
1213
use OCP\AppFramework\ApiController;
1314
use OCP\AppFramework\Http;
15+
use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
1416
use OCP\AppFramework\Http\JSONResponse;
1517
use OCP\IConfig;
1618
use OCP\IRequest;
@@ -31,9 +33,8 @@ public function __construct(
3133

3234
/**
3335
* Get the current app config
34-
*
35-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
3636
*/
37+
#[AuthorizedAdminSetting(settings: Admin::class)]
3738
public function getAppConfig(): JSONResponse {
3839
return new JSONResponse($this->settingsService->getAppSettings());
3940
}
@@ -44,8 +45,8 @@ public function getAppConfig(): JSONResponse {
4445
* @param string $settingsKey AppConfig Key to store
4546
* @param mixed $settingsValues Corresponding AppConfig Value
4647
*
47-
* @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin)
4848
*/
49+
#[AuthorizedAdminSetting(settings: Admin::class)]
4950
public function updateAppConfig(string $settingsKey, $settingsValue): JSONResponse {
5051
$this->logger->debug('Updating AppConfig: {settingsKey} => {settingsValue}', [
5152
'settingsKey' => $settingsKey,

0 commit comments

Comments
 (0)