Move /cloud/user to Core app
This commit is contained in:
parent
02449c8336
commit
69da896785
|
@ -24,25 +24,32 @@ namespace OC\Core\Controller;
|
||||||
use OC\CapabilitiesManager;
|
use OC\CapabilitiesManager;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
use OCP\IUserSession;
|
||||||
|
|
||||||
class OCSController extends \OCP\AppFramework\OCSController {
|
class OCSController extends \OCP\AppFramework\OCSController {
|
||||||
|
|
||||||
/** @var CapabilitiesManager */
|
/** @var CapabilitiesManager */
|
||||||
private $capabilitiesManager;
|
private $capabilitiesManager;
|
||||||
|
|
||||||
|
/** @var IUserSession */
|
||||||
|
private $userSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OCSController constructor.
|
* OCSController constructor.
|
||||||
*
|
*
|
||||||
* @param string $appName
|
* @param string $appName
|
||||||
* @param IRequest $request
|
* @param IRequest $request
|
||||||
* @param CapabilitiesManager $capabilitiesManager
|
* @param CapabilitiesManager $capabilitiesManager
|
||||||
|
* @param IUserSession $userSession
|
||||||
*/
|
*/
|
||||||
public function __construct($appName,
|
public function __construct($appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
CapabilitiesManager $capabilitiesManager) {
|
CapabilitiesManager $capabilitiesManager,
|
||||||
|
IUserSession $userSession) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->capabilitiesManager = $capabilitiesManager;
|
$this->capabilitiesManager = $capabilitiesManager;
|
||||||
|
$this->userSession = $userSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,4 +71,18 @@ class OCSController extends \OCP\AppFramework\OCSController {
|
||||||
|
|
||||||
return new DataResponse(['data' => $result]);
|
return new DataResponse(['data' => $result]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @return DataResponse
|
||||||
|
*/
|
||||||
|
public function getCurrentUser() {
|
||||||
|
$userObject = $this->userSession->getUser();
|
||||||
|
$data = [
|
||||||
|
'id' => $userObject->getUID(),
|
||||||
|
'display-name' => $userObject->getDisplayName(),
|
||||||
|
'email' => $userObject->getEMailAddress(),
|
||||||
|
];
|
||||||
|
return new DataResponse(['data' => $data]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ $application->registerRoutes($this, [
|
||||||
],
|
],
|
||||||
'ocs' => [
|
'ocs' => [
|
||||||
['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
|
['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
|
||||||
|
['root' => '/cloud', 'name' => 'OCS#getCurrentUser', 'url' => '/user', 'verb' => 'GET'],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -83,14 +83,6 @@ API::register(
|
||||||
'core',
|
'core',
|
||||||
API::USER_AUTH
|
API::USER_AUTH
|
||||||
);
|
);
|
||||||
// cloud
|
|
||||||
API::register(
|
|
||||||
'get',
|
|
||||||
'/cloud/user',
|
|
||||||
array('OC_OCS_Cloud', 'getCurrentUser'),
|
|
||||||
'core',
|
|
||||||
API::USER_AUTH
|
|
||||||
);
|
|
||||||
|
|
||||||
// Server-to-Server Sharing
|
// Server-to-Server Sharing
|
||||||
if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
|
if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
|
||||||
|
|
Loading…
Reference in New Issue