Skip to content

Commit 88286bc

Browse files
refactor: Replace security annotations with attributes in LogController
Signed-off-by: Josh <[email protected]>
1 parent 22a232a commit 88286bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
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)

0 commit comments

Comments
 (0)