diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-21 20:06:11 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-21 20:14:18 +0200 |
commit | 66a2f3b0b9b0e1218f38a501095b9e5a9a1b1e9b (patch) | |
tree | e7ab413e53f8db838b569d8410737174620037da | |
parent | a376407da3dcac86f5a2ab41f23545ff6c4b21d9 (diff) | |
download | nextcloud-server-66a2f3b0b9b0e1218f38a501095b9e5a9a1b1e9b.tar.gz nextcloud-server-66a2f3b0b9b0e1218f38a501095b9e5a9a1b1e9b.zip |
New OCS route:
/ocs/cloud/user
Response:
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data>
<id>thomas</id>
<display-name>DeepDiver</display-name>
<email>no-response@domain.tld</email>
</data>
</ocs>
-rw-r--r-- | lib/private/ocs/cloud.php | 13 | ||||
-rw-r--r-- | ocs/routes.php | 9 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index 2dd99319057..cbbf3b626f5 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -64,8 +64,7 @@ class OC_OCS_Cloud { // Check if they are viewing information on themselves if($parameters['userid'] === OC_User::getUser()) { // Self lookup - $quota = array(); - $storage = OC_Helper::getStorageInfo(); + $storage = OC_Helper::getStorageInfo('/'); $quota = array( 'free' => $storage['free'], 'used' => $storage['used'], @@ -79,6 +78,16 @@ class OC_OCS_Cloud { } } + public static function getCurrentUser() { + $email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', ''); + $data = array( + 'id' => OC_User::getUser(), + 'display-name' => OC_User::getDisplayName(), + 'email' => $email, + ); + return new OC_OCS_Result($data); + } + public static function getUserPublickey($parameters) { if(OC_User::userExists($parameters['user'])) { diff --git a/ocs/routes.php b/ocs/routes.php index c4a74d77900..845ee49a46d 100644 --- a/ocs/routes.php +++ b/ocs/routes.php @@ -73,4 +73,11 @@ OC_API::register( array('OC_OCS_Cloud', 'getUser'), 'core', OC_API::USER_AUTH - ); +); +OC_API::register( + 'get', + '/cloud/user', + array('OC_OCS_Cloud', 'getCurrentUser'), + 'core', + OC_API::USER_AUTH +); |