refactor: migrate to scoped execution contexts

Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
2026-07-27 00:50:43 -04:00
parent 9d48710d02
commit 3a68d03114
6 changed files with 60 additions and 60 deletions
+5 -5
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace KTXM\ServiceDav\Auth;
use KTXC\Service\SecurityService;
use KTXC\SessionIdentity;
use KTXC\Context\IdentityContext;
use Sabre\DAV\Auth\Backend\AbstractBasic;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
@@ -15,7 +15,7 @@ class DavAuthBackend extends AbstractBasic
public const PRINCIPAL_PREFIX = 'principals/';
public function __construct(
private readonly SessionIdentity $identity,
private readonly IdentityContext $identityContext,
private readonly SecurityService $securityService,
string $realm = 'KTXC DAV',
) {
@@ -24,8 +24,8 @@ class DavAuthBackend extends AbstractBasic
public function check(RequestInterface $request, ResponseInterface $response): array
{
if ($this->identity->identity() !== null) {
$userId = $this->identity->identifier();
if ($this->identityContext->identity() !== null) {
$userId = $this->identityContext->identifier();
return [true, self::PRINCIPAL_PREFIX . $userId];
}
@@ -39,7 +39,7 @@ class DavAuthBackend extends AbstractBasic
return false;
}
$this->identity->initialize($user, false);
$this->identityContext->initialize($user);
return true;
}
}