aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-09 11:27:55 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-09 20:56:31 +0200
commit69da896785cf3baab583577b119310c1a2938a64 (patch)
treed94b5192558e623215ce69ede6649fa646cd7d13 /core/Controller
parent02449c83365fae8d5a47b001b18605478122bd86 (diff)
downloadnextcloud-server-69da896785cf3baab583577b119310c1a2938a64.tar.gz
nextcloud-server-69da896785cf3baab583577b119310c1a2938a64.zip
Move /cloud/user to Core app
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/OCSController.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php
index 750ab37eb88..d5783ae32e9 100644
--- a/core/Controller/OCSController.php
+++ b/core/Controller/OCSController.php
@@ -24,25 +24,32 @@ namespace OC\Core\Controller;
use OC\CapabilitiesManager;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
+use OCP\IUserSession;
class OCSController extends \OCP\AppFramework\OCSController {
/** @var CapabilitiesManager */
private $capabilitiesManager;
+ /** @var IUserSession */
+ private $userSession;
+
/**
* OCSController constructor.
*
* @param string $appName
* @param IRequest $request
* @param CapabilitiesManager $capabilitiesManager
+ * @param IUserSession $userSession
*/
public function __construct($appName,
IRequest $request,
- CapabilitiesManager $capabilitiesManager) {
+ CapabilitiesManager $capabilitiesManager,
+ IUserSession $userSession) {
parent::__construct($appName, $request);
$this->capabilitiesManager = $capabilitiesManager;
+ $this->userSession = $userSession;
}
/**
@@ -64,4 +71,18 @@ class OCSController extends \OCP\AppFramework\OCSController {
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]);
+ }
}