summaryrefslogtreecommitdiffstats
path: root/core/Controller/OCSController.php
blob: 278a16186bf5a701d91aa3e0b543aa720e9fccdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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]);
	}
}