summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2014-03-04 15:37:45 +0000
committerTom Needham <needham.thomas@gmail.com>2014-03-04 15:37:45 +0000
commit9986b470ee337424eb960541d28620b454dfee3f (patch)
treecbb611e664c94de73603f915686acca9ffe425c1 /lib
parent620dd4afbddce865edc509e462799669a2dd3ed7 (diff)
parentdf38d4ef1a591bd5b1aaa476b6240eac0a059a8e (diff)
downloadnextcloud-server-9986b470ee337424eb960541d28620b454dfee3f.tar.gz
nextcloud-server-9986b470ee337424eb960541d28620b454dfee3f.zip
Merge pull request #7251 from owncloud/fix-ocsapi-getuser
Add displayname for admins on external api
Diffstat (limited to 'lib')
-rw-r--r--lib/private/ocs/cloud.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php
index cbbf3b626f5..06d6a8eb4b0 100644
--- a/lib/private/ocs/cloud.php
+++ b/lib/private/ocs/cloud.php
@@ -61,17 +61,29 @@ class OC_OCS_Cloud {
* the user from whom the information will be returned
*/
public static function getUser($parameters) {
+ $return = array();
// Check if they are viewing information on themselves
if($parameters['userid'] === OC_User::getUser()) {
// Self lookup
$storage = OC_Helper::getStorageInfo('/');
- $quota = array(
+ $return['quota'] = array(
'free' => $storage['free'],
'used' => $storage['used'],
'total' => $storage['total'],
'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 {
// No permission to view this user data
return new OC_OCS_Result(null, 997);