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.

routes.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /**
  3. * @author Björn Schießle <bjoern@schiessle.org>
  4. * @author Christopher Schäpers <kondou@ts.unde.re>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin McCorkell <robin@mccorkell.me.uk>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Tom Needham <tom@owncloud.com>
  10. *
  11. * @copyright Copyright (c) 2016, ownCloud, Inc.
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. use OCP\API;
  28. // Config
  29. API::register(
  30. 'get',
  31. '/config',
  32. array('OC_OCS_Config', 'apiConfig'),
  33. 'core',
  34. API::GUEST_AUTH
  35. );
  36. // Person
  37. API::register(
  38. 'post',
  39. '/person/check',
  40. array('OC_OCS_Person', 'check'),
  41. 'core',
  42. API::GUEST_AUTH
  43. );
  44. // Privatedata
  45. API::register(
  46. 'get',
  47. '/privatedata/getattribute',
  48. array('OC_OCS_Privatedata', 'get'),
  49. 'core',
  50. API::USER_AUTH,
  51. array('app' => '', 'key' => '')
  52. );
  53. API::register(
  54. 'get',
  55. '/privatedata/getattribute/{app}',
  56. array('OC_OCS_Privatedata', 'get'),
  57. 'core',
  58. API::USER_AUTH,
  59. array('key' => '')
  60. );
  61. API::register(
  62. 'get',
  63. '/privatedata/getattribute/{app}/{key}',
  64. array('OC_OCS_Privatedata', 'get'),
  65. 'core',
  66. API::USER_AUTH
  67. );
  68. API::register(
  69. 'post',
  70. '/privatedata/setattribute/{app}/{key}',
  71. array('OC_OCS_Privatedata', 'set'),
  72. 'core',
  73. API::USER_AUTH
  74. );
  75. API::register(
  76. 'post',
  77. '/privatedata/deleteattribute/{app}/{key}',
  78. array('OC_OCS_Privatedata', 'delete'),
  79. 'core',
  80. API::USER_AUTH
  81. );
  82. // cloud
  83. API::register(
  84. 'get',
  85. '/cloud/capabilities',
  86. array('OC_OCS_Cloud', 'getCapabilities'),
  87. 'core',
  88. API::USER_AUTH
  89. );
  90. API::register(
  91. 'get',
  92. '/cloud/user',
  93. array('OC_OCS_Cloud', 'getCurrentUser'),
  94. 'core',
  95. API::USER_AUTH
  96. );
  97. // Server-to-Server Sharing
  98. if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
  99. $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
  100. $addressHandler = new \OCA\FederatedFileSharing\AddressHandler(
  101. \OC::$server->getURLGenerator(),
  102. \OC::$server->getL10N('federatedfilesharing')
  103. );
  104. $notification = new \OCA\FederatedFileSharing\Notifications(
  105. $addressHandler,
  106. \OC::$server->getHTTPClientService(),
  107. new \OCA\FederatedFileSharing\DiscoveryManager(\OC::$server->getMemCacheFactory(), \OC::$server->getHTTPClientService()),
  108. \OC::$server->getJobList()
  109. );
  110. $s2s = new OCA\FederatedFileSharing\RequestHandler(
  111. $federatedSharingApp->getFederatedShareProvider(),
  112. \OC::$server->getDatabaseConnection(),
  113. \OC::$server->getShareManager(),
  114. \OC::$server->getRequest(),
  115. $notification,
  116. $addressHandler,
  117. \OC::$server->getUserManager()
  118. );
  119. API::register('post',
  120. '/cloud/shares',
  121. array($s2s, 'createShare'),
  122. 'files_sharing',
  123. API::GUEST_AUTH
  124. );
  125. API::register('post',
  126. '/cloud/shares/{id}/reshare',
  127. array($s2s, 'reShare'),
  128. 'files_sharing',
  129. API::GUEST_AUTH
  130. );
  131. API::register('post',
  132. '/cloud/shares/{id}/permissions',
  133. array($s2s, 'updatePermissions'),
  134. 'files_sharing',
  135. API::GUEST_AUTH
  136. );
  137. API::register('post',
  138. '/cloud/shares/{id}/accept',
  139. array($s2s, 'acceptShare'),
  140. 'files_sharing',
  141. API::GUEST_AUTH
  142. );
  143. API::register('post',
  144. '/cloud/shares/{id}/decline',
  145. array($s2s, 'declineShare'),
  146. 'files_sharing',
  147. API::GUEST_AUTH
  148. );
  149. API::register('post',
  150. '/cloud/shares/{id}/unshare',
  151. array($s2s, 'unshare'),
  152. 'files_sharing',
  153. API::GUEST_AUTH
  154. );
  155. API::register('post',
  156. '/cloud/shares/{id}/revoke',
  157. array($s2s, 'revoke'),
  158. 'files_sharing',
  159. API::GUEST_AUTH
  160. );
  161. }