summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/UsersController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/lib/Controller/UsersController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index e659b49443b..45839cf4f8d 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -218,6 +218,7 @@ class UsersController extends OCSController {
$userAccount = $this->accountManager->getUser($targetUserObject);
// Find the data
+ $data['id'] = $targetUserObject->getUID();
$data['quota'] = $this->fillStorageInfo($userId);
$data['email'] = $targetUserObject->getEMailAddress();
$data['displayname'] = $targetUserObject->getDisplayName();
@@ -232,6 +233,30 @@ class UsersController extends OCSController {
/**
* @NoAdminRequired
* @NoSubAdminRequired
+ *
+ * gets user info from the currently logged in user
+ *
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function getCurrentUser() {
+ $user = $this->userSession->getUser();
+ if ($user) {
+ $result = $this->getUser($user->getUID());
+ // rename "displayname" to "display-name" only for this call to keep
+ // the API stable.
+ $result['display-name'] = $result['displayname'];
+ unset($result['displayname']);
+ return $result;
+
+ }
+
+ throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
+ }
+
+ /**
+ * @NoAdminRequired
+ * @NoSubAdminRequired
* @PasswordConfirmationRequired
*
* edit users