1
0

routes.php 2.8 KB

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