2014-05-27 17:59:35 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-07-19 12:05:29 +00:00
|
|
|
* ownCloud - Tasks
|
|
|
|
*
|
|
|
|
* @author Raimund Schlüßler
|
|
|
|
* @copyright 2015 Raimund Schlüßler raimund.schluessler@googlemail.com
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2014-05-27 17:59:35 +00:00
|
|
|
|
2014-07-30 19:03:54 +00:00
|
|
|
namespace OCA\Tasks\Controller;
|
2014-05-27 17:59:35 +00:00
|
|
|
|
2015-06-23 10:08:52 +00:00
|
|
|
use \OCA\Tasks\Service\SettingsService;
|
2014-11-18 17:48:18 +00:00
|
|
|
use \OCP\IRequest;
|
2014-08-17 20:35:34 +00:00
|
|
|
use \OCP\AppFramework\Controller;
|
2014-05-27 17:59:35 +00:00
|
|
|
|
|
|
|
class SettingsController extends Controller {
|
|
|
|
|
2015-06-23 10:08:52 +00:00
|
|
|
private $settingsService;
|
2014-08-17 20:35:34 +00:00
|
|
|
|
2015-07-03 14:26:20 +00:00
|
|
|
use Response;
|
|
|
|
|
2015-06-23 10:08:52 +00:00
|
|
|
public function __construct($appName, IRequest $request, SettingsService $settingsService){
|
2014-08-17 20:35:34 +00:00
|
|
|
parent::__construct($appName, $request);
|
2015-06-23 10:08:52 +00:00
|
|
|
$this->settingsService = $settingsService;
|
2014-08-17 20:35:34 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 17:59:35 +00:00
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
*/
|
2014-08-17 20:35:34 +00:00
|
|
|
public function get(){
|
2015-07-03 14:26:20 +00:00
|
|
|
return $this->generateResponse(function () {
|
|
|
|
return ['settings' => $this->settingsService->get()];
|
|
|
|
});
|
2014-05-27 17:59:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
*/
|
2015-06-23 10:08:52 +00:00
|
|
|
public function set($setting, $type, $value){
|
2015-07-03 14:26:20 +00:00
|
|
|
return $this->generateResponse(function () use ($setting, $type, $value) {
|
|
|
|
return $this->settingsService->set($setting, $type, $value);
|
|
|
|
});
|
2014-05-27 17:59:35 +00:00
|
|
|
}
|
2015-07-19 12:05:29 +00:00
|
|
|
}
|