routes.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCA\Testing\AppInfo;
  23. use OCA\Testing\Config;
  24. use OCA\Testing\Locking\Provisioning;
  25. use OCP\API;
  26. $config = new Config(
  27. \OC::$server->getConfig(),
  28. \OC::$server->getRequest()
  29. );
  30. API::register(
  31. 'post',
  32. '/apps/testing/api/v1/app/{appid}/{configkey}',
  33. [$config, 'setAppValue'],
  34. 'testing',
  35. API::ADMIN_AUTH
  36. );
  37. API::register(
  38. 'delete',
  39. '/apps/testing/api/v1/app/{appid}/{configkey}',
  40. [$config, 'deleteAppValue'],
  41. 'testing',
  42. API::ADMIN_AUTH
  43. );
  44. $locking = new Provisioning(
  45. \OC::$server->getLockingProvider(),
  46. \OC::$server->getDatabaseConnection(),
  47. \OC::$server->getConfig(),
  48. \OC::$server->getRequest()
  49. );
  50. API::register('get', '/apps/testing/api/v1/lockprovisioning', [$locking, 'isLockingEnabled'], 'files_lockprovisioning', API::ADMIN_AUTH);
  51. API::register('get', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'isLocked'], 'files_lockprovisioning', API::ADMIN_AUTH);
  52. API::register('post', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'acquireLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
  53. API::register('put', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'changeLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
  54. API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'releaseLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
  55. API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH);
  56. API::register('delete', '/apps/testing/api/v1/lockprovisioning', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH);