1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Nextcloud - Tasks |
4
|
|
|
* |
5
|
|
|
* @author Raimund Schlüßler |
6
|
|
|
* @copyright 2018 Raimund Schlüßler <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This library is free software; you can redistribute it and/or |
9
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
10
|
|
|
* License as published by the Free Software Foundation; either |
11
|
|
|
* version 3 of the License, or any later version. |
12
|
|
|
* |
13
|
|
|
* This library is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU Affero General Public |
19
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
namespace OCA\Tasks\Controller; |
24
|
|
|
|
25
|
|
|
use \OCA\Tasks\Service\SettingsService; |
26
|
|
|
use \OCP\AppFramework\Controller; |
27
|
|
|
use \OCP\IRequest; |
28
|
|
|
|
29
|
|
|
class SettingsController extends Controller { |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var SettingsService |
33
|
|
|
*/ |
34
|
|
|
private $settingsService; |
35
|
|
|
|
36
|
|
|
use Response; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $appName |
40
|
|
|
* @param IRequest $request an instance of the request |
41
|
|
|
* @param SettingsService $settingsService |
42
|
|
|
*/ |
43
|
|
|
public function __construct(string $appName, IRequest $request, SettingsService $settingsService) { |
44
|
|
|
parent::__construct($appName, $request); |
45
|
|
|
$this->settingsService = $settingsService; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @NoAdminRequired |
50
|
|
|
*/ |
51
|
|
|
public function set($setting, $value) { |
52
|
|
|
return $this->generateResponse(function () use ($setting, $value) { |
53
|
|
|
return $this->settingsService->set($setting, $value); |
54
|
|
|
}); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|