generated from Nodarx/template
refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
@@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ServiceDav\Backends;
|
||||
|
||||
use KTXC\SessionIdentity;
|
||||
use KTXC\SessionTenant;
|
||||
use KTXC\Context\IdentityContextInterface;
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
||||
use KTXF\Resource\Identifier\ResourceIdentifiers;
|
||||
@@ -32,8 +32,8 @@ class CardDavBackend extends AbstractBackend
|
||||
|
||||
public function __construct(
|
||||
private readonly PeopleManager $manager,
|
||||
private readonly SessionIdentity $identity,
|
||||
private readonly SessionTenant $tenant,
|
||||
private readonly IdentityContextInterface $identityContext,
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly DavUriMap $uriMap,
|
||||
) {}
|
||||
|
||||
@@ -46,7 +46,7 @@ class CardDavBackend extends AbstractBackend
|
||||
$result = [];
|
||||
|
||||
// collectionList returns [providerId][serviceId][collectionId] => CollectionBaseInterface
|
||||
$allCollections = $this->manager->collectionList($this->tenant->identifier(), $this->identity->identifier());
|
||||
$allCollections = $this->manager->collectionList($this->tenantContext->identifier(), $this->identityContext->identifier());
|
||||
|
||||
foreach ($allCollections as $providerId => $providerServices) {
|
||||
foreach ($providerServices as $serviceId => $collections) {
|
||||
@@ -94,8 +94,8 @@ class CardDavBackend extends AbstractBackend
|
||||
|
||||
public function getCards($addressBookId): array
|
||||
{
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
|
||||
$targets = ResourceIdentifiers::fromArray([$addressBookId]);
|
||||
|
||||
@@ -134,8 +134,8 @@ class CardDavBackend extends AbstractBackend
|
||||
public function getCard($addressBookId, $cardUri): ?array
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($addressBookId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $addressBookId);
|
||||
|
||||
$entityId = $this->uriMap->getEntityId($mapId, $cardUri)
|
||||
@@ -172,8 +172,8 @@ class CardDavBackend extends AbstractBackend
|
||||
public function createCard($addressBookId, $cardUri, $cardData): ?string
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($addressBookId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
|
||||
$vcard = Reader::read($cardData);
|
||||
$props = $this->vcardToEntityProps($vcard);
|
||||
@@ -192,8 +192,8 @@ class CardDavBackend extends AbstractBackend
|
||||
public function updateCard($addressBookId, $cardUri, $cardData): ?string
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($addressBookId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $addressBookId);
|
||||
|
||||
$entityId = $this->uriMap->getEntityId($mapId, $cardUri)
|
||||
@@ -210,8 +210,8 @@ class CardDavBackend extends AbstractBackend
|
||||
public function deleteCard($addressBookId, $cardUri): bool
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($addressBookId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $addressBookId);
|
||||
|
||||
$entityId = $this->uriMap->getEntityId($mapId, $cardUri)
|
||||
|
||||
Reference in New Issue
Block a user