diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-01 16:37:48 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-08 15:01:26 +0200 |
commit | 63f6d2d558f4b999f3851482122f3e3589ce4cfc (patch) | |
tree | 2acfd1860aee66dfd0bfaafbb7ad71dc0d400374 /lib | |
parent | 70eef2a82e1f7a08e8783af16927c21e59d71ccb (diff) | |
download | nextcloud-server-63f6d2d558f4b999f3851482122f3e3589ce4cfc.tar.gz nextcloud-server-63f6d2d558f4b999f3851482122f3e3589ce4cfc.zip |
Allow ocs/v2.php/cloud/... routes
One of the possibilities of the old OCS API is that you can define the
url yourself.
This PR makes this possible again by adding an optional root elemenet to
the route. Routes are thus:
.../ocs/v2.php/<root>/<url>
By default <root> = apps/<app>
This will allow for example the provisioning API etc to be in
../ovs/v2/php/cloud/users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 8 | ||||
-rw-r--r-- | lib/private/Route/Router.php | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 066c0da1138..e94f2e50c1d 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -86,7 +86,13 @@ class RouteConfig { $postfix = $ocsRoute['postfix']; } - $url = $ocsRoute['url']; + if (isset($ocsRoute['root'])) { + $root = $ocsRoute['root']; + } else { + $root = '/apps/'.$this->appName; + } + + $url = $root . $ocsRoute['url']; $verb = isset($ocsRoute['verb']) ? strtoupper($ocsRoute['verb']) : 'GET'; $split = explode('#', $name, 2); diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index ac42c4025c2..9df74184448 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -154,7 +154,7 @@ class Router implements IRouter { // Also add the OCS collection $collection = $this->getCollection($app.'.ocs'); - $collection->addPrefix('/ocsapp/apps/' . $app); + $collection->addPrefix('/ocsapp'); $this->root->addCollection($collection); } } |