getRepository(SftpUser::class)->findOneBy(['username' => $username]); if ($sftpUser instanceof SftpUser && $sftpUser->authenticate($password, $pubKey)) { $storageLocation = $sftpUser->getStation()->getMediaStorageLocation(); $quotaRaw = $storageLocation->getStorageQuotaBytes(); $quota = ($quotaRaw instanceof BigInteger) ? (string)$quotaRaw : 0; $row = [ 'status' => 1, 'username' => $sftpUser->getUsername(), 'expiration_date' => 0, 'home_dir' => $storageLocation->getPath(), 'uid' => 0, 'gid' => 0, 'quota_size' => $quota, 'permissions' => [ '/' => ['*'], ], ]; $io->write(json_encode($row, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK)); return 0; } $io->write(json_encode(['username' => ''], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES)); return 1; } }