diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-03-22 15:59:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 15:59:46 +0300 |
commit | 17abbc2d218ac4f67bf0510214daa980efa3c8cb (patch) | |
tree | 1f2b8514da02b9ccb8fd5a9dfe9430c2f0a61196 | |
parent | e517fc4acf97da94043a9e29a46be01bead606eb (diff) | |
parent | c875e6ccb065e131621dae0122e1cbbded30c106 (diff) |
Merge pull request #678 from nextcloud/bugfix/noid/allow-to-grant-log-accessv24.0.0beta1
Allow to grant log access
-rw-r--r-- | lib/Controller/LogController.php | 20 | ||||
-rw-r--r-- | lib/Settings/Admin.php | 19 |
2 files changed, 34 insertions, 5 deletions
diff --git a/lib/Controller/LogController.php b/lib/Controller/LogController.php index efca149..2cd840e 100644 --- a/lib/Controller/LogController.php +++ b/lib/Controller/LogController.php @@ -49,6 +49,7 @@ class LogController extends Controller { } /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) * @param int $count * @param int $offset * @param string $levels @@ -71,6 +72,7 @@ class LogController extends Controller { } /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) * @brief polls for a new log message since $lastReqId. * This method will sleep for maximum 20 seconds before returning an empty * result. @@ -121,6 +123,7 @@ class LogController extends Controller { } /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) * @param string $query * @param int $count * @param int $offset @@ -138,11 +141,17 @@ class LogController extends Controller { return $this->responseFromIterator($iterator, $count, $offset); } - public function getLevels() { + /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) + */ + public function getLevels(): JSONResponse { return new JSONResponse($this->config->getAppValue('logreader', 'levels', '11111')); } - public function getSettings() { + /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) + */ + public function getSettings(): JSONResponse { return new JSONResponse([ 'levels' => $this->config->getAppValue('logreader', 'levels', '11111'), 'dateformat' => $this->config->getSystemValue('logdateformat', \DateTime::ISO8601), @@ -153,6 +162,7 @@ class LogController extends Controller { } /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) * @param bool $relative */ public function setRelative($relative) { @@ -160,13 +170,17 @@ class LogController extends Controller { } /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) * @param bool $live */ public function setLive($live) { $this->config->setAppValue('logreader', 'live', $live); } - public function setLevels($levels) { + /** + * @AuthorizedAdminSetting(settings=OCA\LogReader\Settings\Admin) + */ + public function setLevels(string $levels): int { $intLevels = array_map('intval', str_split($levels)); $minLevel = 4; foreach ($intLevels as $level => $log) { diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 2d0ac5f..758ab1e 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -22,9 +22,16 @@ namespace OCA\LogReader\Settings; use OCP\AppFramework\Http\TemplateResponse; -use OCP\Settings\ISettings; +use OCP\IL10N; +use OCP\Settings\IDelegatedSettings; -class Admin implements ISettings { +class Admin implements IDelegatedSettings { + /** @var IL10N */ + private $l; + + public function __construct(IL10N $l) { + $this->l = $l; + } /** * @return TemplateResponse */ @@ -52,4 +59,12 @@ class Admin implements ISettings { public function getPriority() { return 90; } + + public function getName(): ?string { + return null; + } + + public function getAuthorizedAppConfig(): array { + return []; + } } |