You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Provider.php 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OC\OCS;
  24. class Provider extends \OCP\AppFramework\Controller {
  25. /** @var \OCP\App\IAppManager */
  26. private $appManager;
  27. /**
  28. * @param string $appName
  29. * @param \OCP\IRequest $request
  30. * @param \OCP\App\IAppManager $appManager
  31. */
  32. public function __construct($appName,
  33. \OCP\IRequest $request,
  34. \OCP\App\IAppManager $appManager) {
  35. parent::__construct($appName, $request);
  36. $this->appManager = $appManager;
  37. }
  38. /**
  39. * @return \OCP\AppFramework\Http\JSONResponse
  40. */
  41. public function buildProviderList() {
  42. $services = [
  43. 'PRIVATE_DATA' => [
  44. 'version' => 1,
  45. 'endpoints' => [
  46. 'store' => '/ocs/v2.php/privatedata/setattribute',
  47. 'read' => '/ocs/v2.php/privatedata/getattribute',
  48. 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
  49. ],
  50. ],
  51. ];
  52. if($this->appManager->isEnabledForUser('files_sharing')) {
  53. $services['SHARING'] = [
  54. 'version' => 1,
  55. 'endpoints' => [
  56. 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
  57. ],
  58. ];
  59. $services['FEDERATED_SHARING'] = [
  60. 'version' => 1,
  61. 'endpoints' => [
  62. 'share' => '/ocs/v2.php/cloud/shares',
  63. 'webdav' => '/public.php/webdav/',
  64. ],
  65. ];
  66. }
  67. if($this->appManager->isEnabledForUser('activity')) {
  68. $services['ACTIVITY'] = [
  69. 'version' => 1,
  70. 'endpoints' => [
  71. 'list' => '/ocs/v2.php/cloud/activity',
  72. ],
  73. ];
  74. }
  75. if($this->appManager->isEnabledForUser('provisioning_api')) {
  76. $services['PROVISIONING'] = [
  77. 'version' => 1,
  78. 'endpoints' => [
  79. 'user' => '/ocs/v2.php/cloud/users',
  80. 'groups' => '/ocs/v2.php/cloud/groups',
  81. 'apps' => '/ocs/v2.php/cloud/apps',
  82. ],
  83. ];
  84. }
  85. return new \OCP\AppFramework\Http\JSONResponse([
  86. 'version' => 2,
  87. 'services' => $services,
  88. ]);
  89. }
  90. }