Skip to content

Commit 12504b6

Browse files
joshtrichardsbackportbot[bot]
authored andcommitted
refactor: Replace security annotations with attributes in LogController
Signed-off-by: Josh <[email protected]>
1 parent ab0ffeb commit 12504b6

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
@@ -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)

0 commit comments

Comments
 (0)