diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-01-24 15:45:55 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-01-25 11:20:35 +0100 |
commit | 5086335643b6181284ee50f57b95525002842992 (patch) | |
tree | 92eb5ecb8726f51253a6e02a54a18bb2ec359890 /apps/provisioning_api/lib | |
parent | fee42647fb06b30cf35e2b21e2e8b5c8ef72bcc8 (diff) | |
download | nextcloud-server-5086335643b6181284ee50f57b95525002842992.tar.gz nextcloud-server-5086335643b6181284ee50f57b95525002842992.zip |
unify endpoints form core and the the provisioning api
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 25 |
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 |