@@ 29-65 (lines=37) @@ | ||
26 | use \OCP\IRequest; |
|
27 | use \OCP\AppFramework\Controller; |
|
28 | ||
29 | class CollectionsController extends Controller { |
|
30 | ||
31 | /** |
|
32 | * @var CollectionsService |
|
33 | */ |
|
34 | private $collectionsService; |
|
35 | ||
36 | use Response; |
|
37 | ||
38 | /** |
|
39 | * @param string $appName |
|
40 | * @param IRequest $request an instance of the request |
|
41 | * @param CollectionsService $collectionsService |
|
42 | */ |
|
43 | public function __construct(string $appName, IRequest $request, CollectionsService $collectionsService){ |
|
44 | parent::__construct($appName, $request); |
|
45 | $this->collectionsService = $collectionsService; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @NoAdminRequired |
|
50 | */ |
|
51 | public function getCollections(){ |
|
52 | return $this->generateResponse(function () { |
|
53 | return ['collections' => $this->collectionsService->getAll()]; |
|
54 | }); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @NoAdminRequired |
|
59 | */ |
|
60 | public function setVisibility($collectionID, $visibility){ |
|
61 | return $this->generateResponse(function () use ($collectionID, $visibility) { |
|
62 | return $this->collectionsService->setVisibility($collectionID, $visibility); |
|
63 | }); |
|
64 | } |
|
65 | } |
|
66 |
@@ 29-65 (lines=37) @@ | ||
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 get(){ |
|
52 | return $this->generateResponse(function () { |
|
53 | return ['settings' => $this->settingsService->get()]; |
|
54 | }); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @NoAdminRequired |
|
59 | */ |
|
60 | public function set($setting, $value) { |
|
61 | return $this->generateResponse(function () use ($setting, $value) { |
|
62 | return $this->settingsService->set($setting, $value); |
|
63 | }); |
|
64 | } |
|
65 | } |
|
66 |