tasks/lib/Controller/CollectionsController.php

58 lines
1.6 KiB
PHP
Raw Normal View History

2014-05-27 17:59:35 +00:00
<?php
/**
* Nextcloud - Tasks
2015-07-19 12:05:29 +00:00
*
* @author Raimund Schlüßler
2018-08-19 20:33:26 +00:00
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
2015-07-19 12:05:29 +00:00
*
* 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\CollectionsService;
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 CollectionsController extends Controller {
2015-06-23 10:08:52 +00:00
private $collectionsService;
2014-08-17 20:35:34 +00:00
use Response;
2015-06-23 10:08:52 +00:00
public function __construct($appName, IRequest $request, CollectionsService $collectionsService){
2014-08-17 20:35:34 +00:00
parent::__construct($appName, $request);
2015-06-23 10:08:52 +00:00
$this->collectionsService = $collectionsService;
2014-08-17 20:35:34 +00:00
}
2014-05-27 17:59:35 +00:00
/**
* @NoAdminRequired
*/
public function getCollections(){
return $this->generateResponse(function () {
return ['collections' => $this->collectionsService->getAll()];
});
2014-05-27 17:59:35 +00:00
}
/**
* @NoAdminRequired
*/
2015-06-23 10:08:52 +00:00
public function setVisibility($collectionID, $visibility){
return $this->generateResponse(function () use ($collectionID, $visibility) {
return $this->collectionsService->setVisibility($collectionID, $visibility);
});
2014-05-27 17:59:35 +00:00
}
2015-07-19 12:05:29 +00:00
}