nextcloud_groupfolder_files.../lib/Controller/AdminSettingsController.php

47 lines
No EOL
1.1 KiB
PHP

<?php
namespace OCA\GroupfolderFilesystemSnapshots\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCA\GroupfolderFilesystemSnapshots\AppInfo\Application;
use OCA\GroupfolderFilesystemSnapshots\Service\SettingsService;
class AdminSettingsController extends Controller {
public function __construct(
private SettingsService $settingsService,
) {
parent::__construct(
Application::APP_ID,
\OC::$server->get(IRequest::class),
);
}
/**
* @return JSONResponse
*/
public function index(): JSONResponse {
return new JSONResponse($this->settingsService->getAppValues());
}
/**
* @param $key
*
* @return JSONResponse
*/
public function show($key): JSONResponse {
return new JSONResponse($this->settingsService->getAppValue($key));
}
/**
* @param $key
* @param $value
*
* @return JSONResponse
*/
public function update($key, $value): JSONResponse {
return new JSONResponse($this->settingsService->setAppValue($key, $value));
}
}