generated from Nodarx/template
refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user