Skip to content
Snippets Groups Projects
Commit 66a2f3b0 authored by Thomas Müller's avatar Thomas Müller
Browse files

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>
parent a376407d
No related branches found
No related tags found
No related merge requests found
...@@ -64,8 +64,7 @@ class OC_OCS_Cloud { ...@@ -64,8 +64,7 @@ class OC_OCS_Cloud {
// Check if they are viewing information on themselves // Check if they are viewing information on themselves
if($parameters['userid'] === OC_User::getUser()) { if($parameters['userid'] === OC_User::getUser()) {
// Self lookup // Self lookup
$quota = array(); $storage = OC_Helper::getStorageInfo('/');
$storage = OC_Helper::getStorageInfo();
$quota = array( $quota = array(
'free' => $storage['free'], 'free' => $storage['free'],
'used' => $storage['used'], 'used' => $storage['used'],
...@@ -79,6 +78,16 @@ class OC_OCS_Cloud { ...@@ -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) { public static function getUserPublickey($parameters) {
if(OC_User::userExists($parameters['user'])) { if(OC_User::userExists($parameters['user'])) {
......
...@@ -73,4 +73,11 @@ OC_API::register( ...@@ -73,4 +73,11 @@ OC_API::register(
array('OC_OCS_Cloud', 'getUser'), array('OC_OCS_Cloud', 'getUser'),
'core', 'core',
OC_API::USER_AUTH OC_API::USER_AUTH
); );
OC_API::register(
'get',
'/cloud/user',
array('OC_OCS_Cloud', 'getCurrentUser'),
'core',
OC_API::USER_AUTH
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment