| @@ 29-57 (lines=29) @@ | ||
| 26 | use \OCP\IRequest; |
|
| 27 | use \OCP\AppFramework\Controller; |
|
| 28 | ||
| 29 | class CollectionsController extends Controller { |
|
| 30 | ||
| 31 | private $collectionsService; |
|
| 32 | ||
| 33 | use Response; |
|
| 34 | ||
| 35 | public function __construct($appName, IRequest $request, CollectionsService $collectionsService){ |
|
| 36 | parent::__construct($appName, $request); |
|
| 37 | $this->collectionsService = $collectionsService; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @NoAdminRequired |
|
| 42 | */ |
|
| 43 | public function getCollections(){ |
|
| 44 | return $this->generateResponse(function () { |
|
| 45 | return ['collections' => $this->collectionsService->getAll()]; |
|
| 46 | }); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @NoAdminRequired |
|
| 51 | */ |
|
| 52 | public function setVisibility($collectionID, $visibility){ |
|
| 53 | return $this->generateResponse(function () use ($collectionID, $visibility) { |
|
| 54 | return $this->collectionsService->setVisibility($collectionID, $visibility); |
|
| 55 | }); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 29-57 (lines=29) @@ | ||
| 26 | use \OCP\AppFramework\Controller; |
|
| 27 | use \OCP\IRequest; |
|
| 28 | ||
| 29 | class SettingsController extends Controller { |
|
| 30 | ||
| 31 | private $settingsService; |
|
| 32 | ||
| 33 | use Response; |
|
| 34 | ||
| 35 | public function __construct($appName, IRequest $request, SettingsService $settingsService){ |
|
| 36 | parent::__construct($appName, $request); |
|
| 37 | $this->settingsService = $settingsService; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @NoAdminRequired |
|
| 42 | */ |
|
| 43 | public function get(){ |
|
| 44 | return $this->generateResponse(function () { |
|
| 45 | return ['settings' => $this->settingsService->get()]; |
|
| 46 | }); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @NoAdminRequired |
|
| 51 | */ |
|
| 52 | public function set($setting, $type, $value){ |
|
| 53 | return $this->generateResponse(function () use ($setting, $type, $value) { |
|
| 54 | return $this->settingsService->set($setting, $type, $value); |
|
| 55 | }); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||