Allow OCS routes in Core and Settings
This commit is contained in:
parent
5214b62d55
commit
575875e8d0
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OC\Core\Controller;
|
||||||
|
|
||||||
|
use OC\CapabilitiesManager;
|
||||||
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
use OCP\IRequest;
|
||||||
|
|
||||||
|
class OCSController extends \OCP\AppFramework\OCSController {
|
||||||
|
|
||||||
|
/** @var CapabilitiesManager */
|
||||||
|
private $capabilitiesManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OCSController constructor.
|
||||||
|
*
|
||||||
|
* @param string $appName
|
||||||
|
* @param IRequest $request
|
||||||
|
* @param CapabilitiesManager $capabilitiesManager
|
||||||
|
*/
|
||||||
|
public function __construct($appName,
|
||||||
|
IRequest $request,
|
||||||
|
CapabilitiesManager $capabilitiesManager) {
|
||||||
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
$this->capabilitiesManager = $capabilitiesManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCapabilities() {
|
||||||
|
$result = [];
|
||||||
|
list($major, $minor, $micro) = \OCP\Util::getVersion();
|
||||||
|
$result['version'] = array(
|
||||||
|
'major' => $major,
|
||||||
|
'minor' => $minor,
|
||||||
|
'micro' => $micro,
|
||||||
|
'string' => \OC_Util::getVersionString(),
|
||||||
|
'edition' => \OC_Util::getEditionString(),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result['capabilities'] = $this->capabilitiesManager->getCapabilities();
|
||||||
|
|
||||||
|
return new DataResponse(['data' => $result]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -163,6 +163,11 @@ class Router implements IRouter {
|
||||||
$this->useCollection('root');
|
$this->useCollection('root');
|
||||||
require_once __DIR__ . '/../../../settings/routes.php';
|
require_once __DIR__ . '/../../../settings/routes.php';
|
||||||
require_once __DIR__ . '/../../../core/routes.php';
|
require_once __DIR__ . '/../../../core/routes.php';
|
||||||
|
|
||||||
|
// Also add the OCS collection
|
||||||
|
$collection = $this->getCollection('root.ocs');
|
||||||
|
$collection->addPrefix('/ocsapp');
|
||||||
|
$this->root->addCollection($collection);
|
||||||
}
|
}
|
||||||
if ($this->loaded) {
|
if ($this->loaded) {
|
||||||
// include ocs routes, must be loaded last for /ocs prefix
|
// include ocs routes, must be loaded last for /ocs prefix
|
||||||
|
|
Loading…
Reference in New Issue