diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-22 13:19:04 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-24 13:44:03 +0200 |
commit | 7f6a72b65d24ea3e887aa40b424db1a6cb713006 (patch) | |
tree | 0b334b2843bd5d3017be04593b2ebaf883bd14aa /apps/testing/appinfo | |
parent | 10efec246de432e27a594d5b237bdef4d8e465eb (diff) | |
download | nextcloud-server-7f6a72b65d24ea3e887aa40b424db1a6cb713006.tar.gz nextcloud-server-7f6a72b65d24ea3e887aa40b424db1a6cb713006.zip |
Move over locking controller
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/testing/appinfo')
-rw-r--r-- | apps/testing/appinfo/routes.php | 104 |
1 files changed, 57 insertions, 47 deletions
diff --git a/apps/testing/appinfo/routes.php b/apps/testing/appinfo/routes.php index aa32e4583c9..3e5fda4fc14 100644 --- a/apps/testing/appinfo/routes.php +++ b/apps/testing/appinfo/routes.php @@ -20,53 +20,63 @@ * */ -namespace OCA\Testing\AppInfo; - -use OCA\Testing\Locking\Provisioning; -use OCP\API; -use OCP\AppFramework\App; - -$app = new App('testing'); -$app->registerRoutes( - $this, - [ - 'routes' => [ - [ - 'name' => 'RateLimitTest#userAndAnonProtected', - 'url' => '/userAndAnonProtected', - 'verb' => 'GET', - ], - [ - 'name' => 'RateLimitTest#onlyAnonProtected', - 'url' => '/anonProtected', - 'verb' => 'GET', - ], +return [ + 'routes' => [ + [ + 'name' => 'RateLimitTest#userAndAnonProtected', + 'url' => '/userAndAnonProtected', + 'verb' => 'GET', ], - 'ocs' => [ - [ - 'name' => 'Config#setAppValue', - 'url' => '/api/v1/app/{appid}/{configkey}', - 'verb' => 'POST', - ], - [ - 'name' => 'Config#deleteAppValue', - 'url' => '/api/v1/app/{appid}/{configkey}', - 'verb' => 'DELETE', - ], + [ + 'name' => 'RateLimitTest#onlyAnonProtected', + 'url' => '/anonProtected', + 'verb' => 'GET', ], - ] -); + ], -$locking = new Provisioning( - \OC::$server->getLockingProvider(), - \OC::$server->getDatabaseConnection(), - \OC::$server->getConfig(), - \OC::$server->getRequest() -); -API::register('get', '/apps/testing/api/v1/lockprovisioning', [$locking, 'isLockingEnabled'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('get', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'isLocked'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('post', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'acquireLock'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('put', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'changeLock'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'releaseLock'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH); -API::register('delete', '/apps/testing/api/v1/lockprovisioning', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH); + 'ocs' => [ + [ + 'name' => 'Config#setAppValue', + 'url' => '/api/v1/app/{appid}/{configkey}', + 'verb' => 'POST', + ], + [ + 'name' => 'Config#deleteAppValue', + 'url' => '/api/v1/app/{appid}/{configkey}', + 'verb' => 'DELETE', + ], + [ + 'name' => 'Locking#isLockingEnabled', + 'url' => '/api/v1/lockprovisioning', + 'verb' => 'GET', + ], + [ + 'name' => 'Locking#isLocked', + 'url' => '/api/v1/lockprovisioning/{type}/{user}', + 'verb' => 'GET', + ], + [ + 'name' => 'Locking#acquireLock', + 'url' => '/api/v1/lockprovisioning/{type}/{user}', + 'verb' => 'POST', + ], + [ + 'name' => 'Locking#changeLock', + 'url' => '/api/v1/lockprovisioning/{type}/{user}', + 'verb' => 'PUT', + ], + [ + 'name' => 'Locking#releaseLock', + 'url' => '/api/v1/lockprovisioning/{type}/{user}', + 'verb' => 'DELETE', + ], + [ + 'name' => 'Locking#releaseAll', + 'url' => '/api/v1/lockprovisioning/{type}', + 'verb' => 'DELETE', + 'defaults' => [ + 'type' => null + ] + ], + ], +]; |