summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-20 11:10:39 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-20 11:10:39 +0200
commit5752e3b3c044e95da20a87c89780ca0c5d2a903a (patch)
tree063293ca21013de02e0da412cab90e7fbb4ff261 /apps/provisioning_api
parent50cb8106dc013ee125af4b377614fd01d34efd8f (diff)
parent002e9c76cdfa805c798ff9f9543df17ae7fa4232 (diff)
downloadnextcloud-server-5752e3b3c044e95da20a87c89780ca0c5d2a903a.tar.gz
nextcloud-server-5752e3b3c044e95da20a87c89780ca0c5d2a903a.zip
Merge pull request #19666 from owncloud/fix_13002
Combine OCS API getUser method code into provisioning_api app
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/lib/users.php37
1 files changed, 10 insertions, 27 deletions
diff --git a/apps/provisioning_api/lib/users.php b/apps/provisioning_api/lib/users.php
index add6325bde0..fc5e79d4b2b 100644
--- a/apps/provisioning_api/lib/users.php
+++ b/apps/provisioning_api/lib/users.php
@@ -115,46 +115,28 @@ class Users {
return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
}
+ $data = [];
+
// Admin? Or SubAdmin?
if($this->groupManager->isAdmin($user->getUID()) || OC_SubAdmin::isUserAccessible($user->getUID(), $userId)) {
// Check they exist
if(!$this->userManager->userExists($userId)) {
return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested user could not be found');
}
- // Show all
- $return = [
- 'email',
- 'enabled',
- ];
- if($user->getUID() !== $userId) {
- $return[] = 'quota';
- }
+ $data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
} else {
// Check they are looking up themselves
if($user->getUID() !== $userId) {
return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
}
- // Return some additional information compared to the core route
- $return = array(
- 'email',
- 'displayname',
- );
}
// Find the data
- $data = [];
- $data = self::fillStorageInfo($userId, $data);
- $data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
+ $data['quota'] = self::fillStorageInfo($userId);
$data['email'] = $this->config->getUserValue($userId, 'settings', 'email');
- $data['displayname'] = $this->userManager->get($parameters['userid'])->getDisplayName();
+ $data['displayname'] = $this->userManager->get($userId)->getDisplayName();
- // Return the appropriate data
- $responseData = array();
- foreach($return as $key) {
- $responseData[$key] = $data[$key];
- }
-
- return new OC_OCS_Result($responseData);
+ return new OC_OCS_Result($data);
}
/**
@@ -473,19 +455,20 @@ class Users {
* @return mixed
* @throws \OCP\Files\NotFoundException
*/
- private static function fillStorageInfo($userId, $data) {
+ private static function fillStorageInfo($userId) {
+ $data = [];
try {
\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);
$storage = OC_Helper::getStorageInfo('/');
- $data['quota'] = [
+ $data = [
'free' => $storage['free'],
'used' => $storage['used'],
'total' => $storage['total'],
'relative' => $storage['relative'],
];
} catch (NotFoundException $ex) {
- $data['quota'] = [];
+ $data = [];
}
return $data;
}