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\Chrono\Entity\JournalObject;
|
||||
use KTXF\Chrono\Entity\TaskObject;
|
||||
use KTXM\ChronoManager\Conversion\IcalDecoder;
|
||||
@@ -39,8 +39,8 @@ class CalDavBackend extends AbstractBackend
|
||||
|
||||
public function __construct(
|
||||
private readonly ChronoManager $manager,
|
||||
private readonly SessionIdentity $identity,
|
||||
private readonly SessionTenant $tenant,
|
||||
private readonly IdentityContextInterface $identityContext,
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly DavUriMap $uriMap,
|
||||
private readonly IcalEncoder $encoder,
|
||||
private readonly IcalDecoder $decoder,
|
||||
@@ -50,7 +50,7 @@ class CalDavBackend extends AbstractBackend
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$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) {
|
||||
@@ -93,8 +93,8 @@ class CalDavBackend extends AbstractBackend
|
||||
public function getCalendarObjects($calendarId): array
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($calendarId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
|
||||
$targets = ResourceIdentifiers::fromArray([$calendarId]);
|
||||
$all = $this->manager->entityListBulk($tenantId, $userId, $targets);
|
||||
@@ -127,8 +127,8 @@ class CalDavBackend extends AbstractBackend
|
||||
public function getCalendarObject($calendarId, $objectUri): ?array
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($calendarId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $calendarId);
|
||||
|
||||
// Resolve URI => entityId via the map; fall back to treating stripped URI as entityId
|
||||
@@ -167,8 +167,8 @@ class CalDavBackend extends AbstractBackend
|
||||
public function createCalendarObject($calendarId, $objectUri, $calendarData): ?string
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($calendarId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
|
||||
$vcal = Reader::read($calendarData);
|
||||
$props = $this->icalToEntityProps($vcal);
|
||||
@@ -190,8 +190,8 @@ class CalDavBackend extends AbstractBackend
|
||||
public function updateCalendarObject($calendarId, $objectUri, $calendarData): ?string
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($calendarId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $calendarId);
|
||||
|
||||
$entityId = $this->uriMap->getEntityId($mapId, $objectUri)
|
||||
@@ -210,8 +210,8 @@ class CalDavBackend extends AbstractBackend
|
||||
public function deleteCalendarObject($calendarId, $objectUri): void
|
||||
{
|
||||
[$providerId, $serviceId, $collectionId] = $this->parseId($calendarId);
|
||||
$tenantId = $this->tenant->identifier();
|
||||
$userId = $this->identity->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$userId = $this->identityContext->identifier();
|
||||
$mapId = $this->mapId($tenantId, $userId, $calendarId);
|
||||
|
||||
$entityId = $this->uriMap->getEntityId($mapId, $objectUri)
|
||||
|
||||
Reference in New Issue
Block a user