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.6KB

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