Merge pull request #5452 from owncloud/fixing-4548-master

OCS API to get current user information
This commit is contained in:
Frank Karlitschek 2013-10-21 12:02:21 -07:00
commit be5e1e990b
2 changed files with 19 additions and 3 deletions

View File

@ -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'])) {

View File

@ -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
);