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.

132 lines
4.4 KiB

11 years ago
11 years ago
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Georg Ehrke <georg@owncloud.com>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Lukas Reschke <lukas@owncloud.com>
  7. * @author Robin Appelman <icewind@owncloud.com>
  8. * @author Roeland Jago Douma <rullzer@owncloud.com>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @copyright Copyright (c) 2015, 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. namespace OCA\Files_Sharing\AppInfo;
  28. use OCP\API;
  29. $application = new Application();
  30. $application->registerRoutes($this, [
  31. 'resources' => [
  32. 'ExternalShares' => ['url' => '/api/externalShares'],
  33. ],
  34. 'routes' => [
  35. [
  36. 'name' => 'externalShares#testRemote',
  37. 'url' => '/testremote',
  38. 'verb' => 'GET'
  39. ],
  40. ],
  41. ]);
  42. /** @var $this \OCP\Route\IRouter */
  43. $this->create('core_ajax_public_preview', '/publicpreview')->action(
  44. function() {
  45. require_once __DIR__ . '/../ajax/publicpreview.php';
  46. });
  47. $this->create('files_sharing_ajax_list', 'ajax/list.php')
  48. ->actionInclude('files_sharing/ajax/list.php');
  49. $this->create('files_sharing_ajax_publicpreview', 'ajax/publicpreview.php')
  50. ->actionInclude('files_sharing/ajax/publicpreview.php');
  51. $this->create('sharing_external_shareinfo', '/shareinfo')
  52. ->actionInclude('files_sharing/ajax/shareinfo.php');
  53. $this->create('sharing_external_add', '/external')
  54. ->actionInclude('files_sharing/ajax/external.php');
  55. // OCS API
  56. //TODO: SET: mail notification, waiting for PR #4689 to be accepted
  57. API::register('get',
  58. '/apps/files_sharing/api/v1/shares',
  59. array('\OCA\Files_Sharing\API\Local', 'getAllShares'),
  60. 'files_sharing');
  61. API::register('post',
  62. '/apps/files_sharing/api/v1/shares',
  63. array('\OCA\Files_Sharing\API\Local', 'createShare'),
  64. 'files_sharing');
  65. API::register('get',
  66. '/apps/files_sharing/api/v1/shares/{id}',
  67. array('\OCA\Files_Sharing\API\Local', 'getShare'),
  68. 'files_sharing');
  69. API::register('put',
  70. '/apps/files_sharing/api/v1/shares/{id}',
  71. array('\OCA\Files_Sharing\API\Local', 'updateShare'),
  72. 'files_sharing');
  73. API::register('delete',
  74. '/apps/files_sharing/api/v1/shares/{id}',
  75. array('\OCA\Files_Sharing\API\Local', 'deleteShare'),
  76. 'files_sharing');
  77. API::register('get',
  78. '/apps/files_sharing/api/v1/remote_shares',
  79. array('\OCA\Files_Sharing\API\Remote', 'getShares'),
  80. 'files_sharing');
  81. API::register('get',
  82. '/apps/files_sharing/api/v1/remote_shares/pending',
  83. array('\OCA\Files_Sharing\API\Remote', 'getOpenShares'),
  84. 'files_sharing');
  85. API::register('post',
  86. '/apps/files_sharing/api/v1/remote_shares/pending/{id}',
  87. array('\OCA\Files_Sharing\API\Remote', 'acceptShare'),
  88. 'files_sharing');
  89. API::register('delete',
  90. '/apps/files_sharing/api/v1/remote_shares/pending/{id}',
  91. array('\OCA\Files_Sharing\API\Remote', 'declineShare'),
  92. 'files_sharing');
  93. API::register('get',
  94. '/apps/files_sharing/api/v1/remote_shares/{id}',
  95. array('\OCA\Files_Sharing\API\Remote', 'getShare'),
  96. 'files_sharing');
  97. API::register('delete',
  98. '/apps/files_sharing/api/v1/remote_shares/{id}',
  99. array('\OCA\Files_Sharing\API\Remote', 'unshare'),
  100. 'files_sharing');
  101. $sharees = new \OCA\Files_Sharing\API\Sharees(\OC::$server->getGroupManager(),
  102. \OC::$server->getUserManager(),
  103. \OC::$server->getContactsManager(),
  104. \OC::$server->getConfig(),
  105. \OC::$server->getUserSession(),
  106. \OC::$server->getURLGenerator(),
  107. \OC::$server->getRequest(),
  108. \OC::$server->getLogger());
  109. API::register('get',
  110. '/apps/files_sharing/api/v1/sharees',
  111. [$sharees, 'search'],
  112. 'files_sharing', API::USER_AUTH);