aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/User
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/User')
-rw-r--r--core/Command/User/Info.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php
index e6ba691a40d..377b722d293 100644
--- a/core/Command/User/Info.php
+++ b/core/Command/User/Info.php
@@ -26,6 +26,7 @@ namespace OC\Core\Command\User;
use OC\Core\Command\Base;
use OCP\IGroupManager;
+use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -80,6 +81,7 @@ class Info extends Base {
'enabled' => $user->isEnabled(),
'groups' => $groups,
'quota' => $user->getQuota(),
+ 'storage' => $this->getStorageInfo($user),
'last_seen' => date(\DateTimeInterface::ATOM, $user->getLastLogin()), // ISO-8601
'user_directory' => $user->getHome(),
'backend' => $user->getBackendClassName()
@@ -87,4 +89,21 @@ class Info extends Base {
$this->writeArrayInOutputFormat($input, $output, $data);
return 0;
}
+
+ /**
+ * @param IUser $user
+ * @return array
+ */
+ protected function getStorageInfo(IUser $user): array {
+ \OC_Util::tearDownFS();
+ \OC_Util::setupFS($user->getUID());
+ $storage = \OC_Helper::getStorageInfo('/');
+ return [
+ 'free' => $storage['free'],
+ 'used' => $storage['used'],
+ 'total' => $storage['total'],
+ 'relative' => $storage['relative'],
+ 'quota' => $storage['quota'],
+ ];
+ }
}