UserSession class [6] - Refactor src/Module/ files without DI

This commit is contained in:
Philipp 2022-10-20 23:35:01 +02:00
parent bf39b5a948
commit 22198ea495
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
8 changed files with 74 additions and 38 deletions

View file

@ -21,19 +21,33 @@
namespace Friendica\Module;
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Session;
use Friendica\Core\L10n;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Core\System;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Util;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
class ParseUrl extends BaseModule
{
/** @var IHandleUserSessions */
protected $userSession;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Session\Capability\IHandleUserSessions $userSession, $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->userSession = $userSession;
}
protected function rawContent(array $request = [])
{
if (!Session::isAuthenticated()) {
if (!$this->userSession->isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();
}