Merge pull request #7251 from owncloud/fix-ocsapi-getuser
Add displayname for admins on external api
This commit is contained in:
commit
9986b470ee
|
@ -61,17 +61,29 @@ class OC_OCS_Cloud {
|
||||||
* the user from whom the information will be returned
|
* the user from whom the information will be returned
|
||||||
*/
|
*/
|
||||||
public static function getUser($parameters) {
|
public static function getUser($parameters) {
|
||||||
|
$return = array();
|
||||||
// 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
|
||||||
$storage = OC_Helper::getStorageInfo('/');
|
$storage = OC_Helper::getStorageInfo('/');
|
||||||
$quota = array(
|
$return['quota'] = array(
|
||||||
'free' => $storage['free'],
|
'free' => $storage['free'],
|
||||||
'used' => $storage['used'],
|
'used' => $storage['used'],
|
||||||
'total' => $storage['total'],
|
'total' => $storage['total'],
|
||||||
'relative' => $storage['relative'],
|
'relative' => $storage['relative'],
|
||||||
);
|
);
|
||||||
return new OC_OCS_Result(array('quota' => $quota));
|
}
|
||||||
|
if(OC_User::isAdminUser(OC_User::getUser())
|
||||||
|
|| OC_Subadmin::isUserAccessible(OC_User::getUser(), $parameters['userid'])) {
|
||||||
|
if(OC_User::userExists($parameters['userid'])) {
|
||||||
|
// Is an admin/subadmin so can see display name
|
||||||
|
$return['displayname'] = OC_User::getDisplayName($parameters['userid']);
|
||||||
|
} else {
|
||||||
|
return new OC_OCS_Result(null, 101);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($return)) {
|
||||||
|
return new OC_OCS_Result($return);
|
||||||
} else {
|
} else {
|
||||||
// No permission to view this user data
|
// No permission to view this user data
|
||||||
return new OC_OCS_Result(null, 997);
|
return new OC_OCS_Result(null, 997);
|
||||||
|
|
Loading…
Reference in New Issue