Add Typed Events for CalDAV- and CardDAV-related Eventstags/v20.0.0beta1
@@ -57,8 +57,10 @@ $db = \OC::$server->getDatabaseConnection(); | |||
$userManager = \OC::$server->getUserManager(); | |||
$random = \OC::$server->getSecureRandom(); | |||
$logger = \OC::$server->getLogger(); | |||
$dispatcher = \OC::$server->getEventDispatcher(); | |||
$calDavBackend = new CalDavBackend($db, $principalBackend, $userManager, \OC::$server->getGroupManager(), $random, $logger, $dispatcher, true); | |||
$dispatcher = \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class); | |||
$legacyDispatcher = \OC::$server->getEventDispatcher(); | |||
$calDavBackend = new CalDavBackend($db, $principalBackend, $userManager, \OC::$server->getGroupManager(), $random, $logger, $dispatcher, $legacyDispatcher, true); | |||
$debugging = \OC::$server->getConfig()->getSystemValue('debug', false); | |||
$sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes'; |
@@ -57,7 +57,7 @@ $principalBackend = new Principal( | |||
'principals/' | |||
); | |||
$db = \OC::$server->getDatabaseConnection(); | |||
$cardDavBackend = new CardDavBackend($db, $principalBackend, \OC::$server->getUserManager(), \OC::$server->getGroupManager(), \OC::$server->getEventDispatcher()); | |||
$cardDavBackend = new CardDavBackend($db, $principalBackend, \OC::$server->getUserManager(), \OC::$server->getGroupManager(), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->getEventDispatcher()); | |||
$debugging = \OC::$server->getConfig()->getSystemValue('debug', false); | |||
@@ -170,7 +170,29 @@ return array( | |||
'OCA\\DAV\\Direct\\DirectHome' => $baseDir . '/../lib/Direct/DirectHome.php', | |||
'OCA\\DAV\\Direct\\Server' => $baseDir . '/../lib/Direct/Server.php', | |||
'OCA\\DAV\\Direct\\ServerFactory' => $baseDir . '/../lib/Direct/ServerFactory.php', | |||
'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir . '/../lib/Events/AddressBookCreatedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir . '/../lib/Events/AddressBookDeletedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookShareUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir . '/../lib/Events/CalendarCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir . '/../lib/Events/CalendarDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CalendarObjectCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CalendarObjectDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CalendarObjectUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir . '/../lib/Events/CalendarPublishedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir . '/../lib/Events/CalendarShareUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir . '/../lib/Events/CalendarUnpublishedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir . '/../lib/Events/CalendarUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir . '/../lib/Events/CardCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir . '/../lib/Events/CardDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir . '/../lib/Events/CardUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir . '/../lib/Events/SabrePluginAuthInitEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir . '/../lib/Events/SubscriptionCreatedEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir . '/../lib/Events/SubscriptionDeletedEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir . '/../lib/Events/SubscriptionUpdatedEvent.php', | |||
'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', | |||
'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir . '/../lib/Files/BrowserErrorPagePlugin.php', | |||
'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir . '/../lib/Files/FileSearchBackend.php', |
@@ -185,7 +185,29 @@ class ComposerStaticInitDAV | |||
'OCA\\DAV\\Direct\\DirectHome' => __DIR__ . '/..' . '/../lib/Direct/DirectHome.php', | |||
'OCA\\DAV\\Direct\\Server' => __DIR__ . '/..' . '/../lib/Direct/Server.php', | |||
'OCA\\DAV\\Direct\\ServerFactory' => __DIR__ . '/..' . '/../lib/Direct/ServerFactory.php', | |||
'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookCreatedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookDeletedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookShareUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarPublishedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarShareUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUnpublishedEvent.php', | |||
'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardCreatedEvent.php', | |||
'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CardDeletedEvent.php', | |||
'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardUpdatedEvent.php', | |||
'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAuthInitEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionCreatedEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionDeletedEvent.php', | |||
'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionUpdatedEvent.php', | |||
'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__ . '/..' . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', | |||
'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__ . '/..' . '/../lib/Files/BrowserErrorPagePlugin.php', | |||
'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__ . '/..' . '/../lib/Files/FileSearchBackend.php', |
@@ -39,7 +39,23 @@ use DateTime; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCA\DAV\DAV\Sharing\Backend; | |||
use OCA\DAV\DAV\Sharing\IShareable; | |||
use OCA\DAV\Events\CachedCalendarObjectCreatedEvent; | |||
use OCA\DAV\Events\CachedCalendarObjectDeletedEvent; | |||
use OCA\DAV\Events\CachedCalendarObjectUpdatedEvent; | |||
use OCA\DAV\Events\CalendarCreatedEvent; | |||
use OCA\DAV\Events\CalendarDeletedEvent; | |||
use OCA\DAV\Events\CalendarObjectCreatedEvent; | |||
use OCA\DAV\Events\CalendarObjectDeletedEvent; | |||
use OCA\DAV\Events\CalendarObjectUpdatedEvent; | |||
use OCA\DAV\Events\CalendarPublishedEvent; | |||
use OCA\DAV\Events\CalendarShareUpdatedEvent; | |||
use OCA\DAV\Events\CalendarUnpublishedEvent; | |||
use OCA\DAV\Events\CalendarUpdatedEvent; | |||
use OCA\DAV\Events\SubscriptionCreatedEvent; | |||
use OCA\DAV\Events\SubscriptionDeletedEvent; | |||
use OCA\DAV\Events\SubscriptionUpdatedEvent; | |||
use OCP\DB\QueryBuilder\IQueryBuilder; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IDBConnection; | |||
use OCP\IGroupManager; | |||
use OCP\ILogger; | |||
@@ -166,9 +182,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
/** @var ILogger */ | |||
private $logger; | |||
/** @var EventDispatcherInterface */ | |||
/** @var IEventDispatcher */ | |||
private $dispatcher; | |||
/** @var EventDispatcherInterface */ | |||
private $legacyDispatcher; | |||
/** @var bool */ | |||
private $legacyEndpoint; | |||
@@ -184,7 +203,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
* @param IGroupManager $groupManager | |||
* @param ISecureRandom $random | |||
* @param ILogger $logger | |||
* @param EventDispatcherInterface $dispatcher | |||
* @param IEventDispatcher $dispatcher | |||
* @param EventDispatcherInterface $legacyDispatcher | |||
* @param bool $legacyEndpoint | |||
*/ | |||
public function __construct(IDBConnection $db, | |||
@@ -193,7 +213,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
IGroupManager $groupManager, | |||
ISecureRandom $random, | |||
ILogger $logger, | |||
EventDispatcherInterface $dispatcher, | |||
IEventDispatcher $dispatcher, | |||
EventDispatcherInterface $legacyDispatcher, | |||
bool $legacyEndpoint = false) { | |||
$this->db = $db; | |||
$this->principalBackend = $principalBackend; | |||
@@ -202,6 +223,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$this->random = $random; | |||
$this->logger = $logger; | |||
$this->dispatcher = $dispatcher; | |||
$this->legacyDispatcher = $legacyDispatcher; | |||
$this->legacyEndpoint = $legacyEndpoint; | |||
} | |||
@@ -764,11 +786,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$query->execute(); | |||
$calendarId = $query->getLastInsertId(); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( | |||
$calendarData = $this->getCalendarById($calendarId); | |||
$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::createCalendar', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'calendarData' => $calendarData, | |||
])); | |||
return $calendarId; | |||
@@ -821,12 +845,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$this->addChange($calendarId, "", 2); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( | |||
$calendarData = $this->getCalendarById($calendarId); | |||
$shares = $this->getShares($calendarId); | |||
$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'calendarData' => $calendarData, | |||
'shares' => $shares, | |||
'propertyMutations' => $mutations, | |||
])); | |||
@@ -841,12 +868,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
* @return void | |||
*/ | |||
public function deleteCalendar($calendarId) { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent( | |||
$calendarData = $this->getCalendarById($calendarId); | |||
$shares = $this->getShares($calendarId); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'calendarData' => $calendarData, | |||
'shares' => $shares, | |||
])); | |||
$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?'); | |||
@@ -865,6 +895,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) | |||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))) | |||
->execute(); | |||
if ($calendarData) { | |||
$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); | |||
} | |||
} | |||
/** | |||
@@ -1085,29 +1119,37 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
->execute(); | |||
$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); | |||
$this->addChange($calendarId, $objectUri, 1, $calendarType); | |||
$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); | |||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( | |||
$calendarRow = $this->getCalendarById($calendarId); | |||
$shares = $this->getShares($calendarId); | |||
$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'objectData' => $this->getCalendarObject($calendarId, $objectUri), | |||
'calendarData' => $calendarRow, | |||
'shares' => $shares, | |||
'objectData' => $objectRow, | |||
] | |||
)); | |||
} else { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($calendarId); | |||
$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', | |||
[ | |||
'subscriptionId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'objectData' => $this->getCalendarObject($calendarId, $objectUri), | |||
'calendarData' => $subscriptionRow, | |||
'shares' => [], | |||
'objectData' => $objectRow, | |||
] | |||
)); | |||
} | |||
$this->addChange($calendarId, $objectUri, 1, $calendarType); | |||
return '"' . $extraData['etag'] . '"'; | |||
} | |||
@@ -1150,32 +1192,39 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
->execute(); | |||
$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); | |||
$this->addChange($calendarId, $objectUri, 2, $calendarType); | |||
$data = $this->getCalendarObject($calendarId, $objectUri); | |||
if (is_array($data)) { | |||
$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); | |||
if (is_array($objectRow)) { | |||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( | |||
$calendarRow = $this->getCalendarById($calendarId); | |||
$shares = $this->getShares($calendarId); | |||
$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'objectData' => $data, | |||
'calendarData' => $calendarRow, | |||
'shares' => $shares, | |||
'objectData' => $objectRow, | |||
] | |||
)); | |||
} else { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($calendarId); | |||
$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', | |||
[ | |||
'subscriptionId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'objectData' => $data, | |||
'calendarData' => $subscriptionRow, | |||
'shares' => [], | |||
'objectData' => $objectRow, | |||
] | |||
)); | |||
} | |||
} | |||
$this->addChange($calendarId, $objectUri, 2, $calendarType); | |||
return '"' . $extraData['etag'] . '"'; | |||
} | |||
@@ -1211,22 +1260,29 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); | |||
if (is_array($data)) { | |||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( | |||
$calendarRow = $this->getCalendarById($calendarId); | |||
$shares = $this->getShares($calendarId); | |||
$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'calendarData' => $calendarRow, | |||
'shares' => $shares, | |||
'objectData' => $data, | |||
] | |||
)); | |||
} else { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($calendarId); | |||
$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', | |||
[ | |||
'subscriptionId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'calendarData' => $subscriptionRow, | |||
'shares' => [], | |||
'objectData' => $data, | |||
] | |||
)); | |||
@@ -2060,11 +2116,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($subscriptionId); | |||
$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int)$subscriptionId, $subscriptionRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::createSubscription', | |||
[ | |||
'subscriptionId' => $subscriptionId, | |||
'subscriptionData' => $this->getSubscriptionById($subscriptionId), | |||
'subscriptionData' => $subscriptionRow, | |||
])); | |||
return $subscriptionId; | |||
@@ -2114,11 +2172,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) | |||
->execute(); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($subscriptionId); | |||
$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', | |||
[ | |||
'subscriptionId' => $subscriptionId, | |||
'subscriptionData' => $this->getSubscriptionById($subscriptionId), | |||
'subscriptionData' => $subscriptionRow, | |||
'propertyMutations' => $mutations, | |||
])); | |||
@@ -2133,7 +2193,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
* @return void | |||
*/ | |||
public function deleteSubscription($subscriptionId) { | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( | |||
$subscriptionRow = $this->getSubscriptionById($subscriptionId); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', | |||
[ | |||
'subscriptionId' => $subscriptionId, | |||
@@ -2160,6 +2222,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) | |||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) | |||
->execute(); | |||
if ($subscriptionRow) { | |||
$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); | |||
} | |||
} | |||
/** | |||
@@ -2412,16 +2478,21 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
*/ | |||
public function updateShares($shareable, $add, $remove) { | |||
$calendarId = $shareable->getResourceId(); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( | |||
$calendarRow = $this->getCalendarById($calendarId); | |||
$oldShares = $this->getShares($calendarId); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateShares', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'shares' => $this->getShares($calendarId), | |||
'calendarData' => $calendarRow, | |||
'shares' => $oldShares, | |||
'add' => $add, | |||
'remove' => $remove, | |||
])); | |||
$this->calendarSharingBackend->updateShares($shareable, $add, $remove); | |||
$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); | |||
} | |||
/** | |||
@@ -2440,11 +2511,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
*/ | |||
public function setPublishStatus($value, $calendar) { | |||
$calendarId = $calendar->getResourceId(); | |||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( | |||
$calendarData = $this->getCalendarById($calendarId); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( | |||
'\OCA\DAV\CalDAV\CalDavBackend::updateShares', | |||
[ | |||
'calendarId' => $calendarId, | |||
'calendarData' => $this->getCalendarById($calendarId), | |||
'calendarData' => $calendarData, | |||
'public' => $value, | |||
])); | |||
@@ -2460,12 +2532,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription | |||
'publicuri' => $query->createNamedParameter($publicUri) | |||
]); | |||
$query->execute(); | |||
$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); | |||
return $publicUri; | |||
} | |||
$query->delete('dav_shares') | |||
->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) | |||
->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); | |||
$query->execute(); | |||
$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); | |||
return null; | |||
} | |||
@@ -40,7 +40,15 @@ namespace OCA\DAV\CardDAV; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCA\DAV\DAV\Sharing\Backend; | |||
use OCA\DAV\DAV\Sharing\IShareable; | |||
use OCA\DAV\Events\AddressBookCreatedEvent; | |||
use OCA\DAV\Events\AddressBookDeletedEvent; | |||
use OCA\DAV\Events\AddressBookShareUpdatedEvent; | |||
use OCA\DAV\Events\AddressBookUpdatedEvent; | |||
use OCA\DAV\Events\CardCreatedEvent; | |||
use OCA\DAV\Events\CardDeletedEvent; | |||
use OCA\DAV\Events\CardUpdatedEvent; | |||
use OCP\DB\QueryBuilder\IQueryBuilder; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IDBConnection; | |||
use OCP\IGroupManager; | |||
use OCP\IUser; | |||
@@ -87,9 +95,12 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
/** @var IUserManager */ | |||
private $userManager; | |||
/** @var EventDispatcherInterface */ | |||
/** @var IEventDispatcher */ | |||
private $dispatcher; | |||
/** @var EventDispatcherInterface */ | |||
private $legacyDispatcher; | |||
private $etagCache = []; | |||
/** | |||
@@ -99,17 +110,20 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* @param Principal $principalBackend | |||
* @param IUserManager $userManager | |||
* @param IGroupManager $groupManager | |||
* @param EventDispatcherInterface $dispatcher | |||
* @param IEventDispatcher $dispatcher | |||
* @param EventDispatcherInterface $legacyDispatcher | |||
*/ | |||
public function __construct(IDBConnection $db, | |||
Principal $principalBackend, | |||
IUserManager $userManager, | |||
IGroupManager $groupManager, | |||
EventDispatcherInterface $dispatcher) { | |||
IEventDispatcher $dispatcher, | |||
EventDispatcherInterface $legacyDispatcher) { | |||
$this->db = $db; | |||
$this->principalBackend = $principalBackend; | |||
$this->userManager = $userManager; | |||
$this->dispatcher = $dispatcher; | |||
$this->legacyDispatcher = $legacyDispatcher; | |||
$this->sharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'addressbook'); | |||
} | |||
@@ -388,6 +402,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$this->addChange($addressBookId, "", 2); | |||
$addressBookRow = $this->getAddressBookById((int)$addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); | |||
return true; | |||
}); | |||
} | |||
@@ -441,7 +459,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
->setParameters($values) | |||
->execute(); | |||
return $query->getLastInsertId(); | |||
$addressBookId = $query->getLastInsertId(); | |||
$addressBookRow = $this->getAddressBookById($addressBookId); | |||
$this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow)); | |||
return $addressBookId; | |||
} | |||
/** | |||
@@ -451,6 +473,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* @return void | |||
*/ | |||
public function deleteAddressBook($addressBookId) { | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$query = $this->db->getQueryBuilder(); | |||
$query->delete($this->dbCardsTable) | |||
->where($query->expr()->eq('addressbookid', $query->createParameter('addressbookid'))) | |||
@@ -472,6 +497,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$query->delete($this->dbCardsPropertiesTable) | |||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))) | |||
->execute(); | |||
if ($addressBookData) { | |||
$this->dispatcher->dispatchTyped(new AddressBookDeletedEvent((int) $addressBookId, $addressBookData, $shares)); | |||
} | |||
} | |||
/** | |||
@@ -661,7 +690,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$this->addChange($addressBookId, $cardUri, 1); | |||
$this->updateProperties($addressBookId, $cardUri, $cardData); | |||
$this->dispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$objectRow = $this->getCard($addressBookId, $cardUri); | |||
$this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
'cardUri' => $cardUri, | |||
@@ -721,7 +754,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$this->addChange($addressBookId, $cardUri, 2); | |||
$this->updateProperties($addressBookId, $cardUri, $cardData); | |||
$this->dispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$objectRow = $this->getCard($addressBookId, $cardUri); | |||
$this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
'cardUri' => $cardUri, | |||
@@ -738,6 +775,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* @return bool | |||
*/ | |||
public function deleteCard($addressBookId, $cardUri) { | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$objectRow = $this->getCard($addressBookId, $cardUri); | |||
try { | |||
$cardId = $this->getCardId($addressBookId, $cardUri); | |||
} catch (\InvalidArgumentException $e) { | |||
@@ -751,13 +792,14 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$this->addChange($addressBookId, $cardUri, 3); | |||
$this->dispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
'cardUri' => $cardUri])); | |||
if ($ret === 1) { | |||
if ($cardId !== null) { | |||
$this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
'cardUri' => $cardUri])); | |||
$this->purgeProperties($addressBookId, $cardId); | |||
} | |||
return true; | |||
@@ -947,7 +989,13 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* @param string[] $remove | |||
*/ | |||
public function updateShares(IShareable $shareable, $add, $remove) { | |||
$addressBookId = $shareable->getResourceId(); | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$oldShares = $this->getShares($addressBookId); | |||
$this->sharingBackend->updateShares($shareable, $add, $remove); | |||
$this->dispatcher->dispatchTyped(new AddressBookShareUpdatedEvent($addressBookId, $addressBookData, $oldShares, $add, $remove)); | |||
} | |||
/** |
@@ -30,6 +30,7 @@ namespace OCA\DAV\Command; | |||
use OCA\DAV\CalDAV\CalDavBackend; | |||
use OCA\DAV\CalDAV\Proxy\ProxyMapper; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IDBConnection; | |||
use OCP\IGroupManager; | |||
use OCP\IUserManager; | |||
@@ -89,10 +90,11 @@ class CreateCalendar extends Command { | |||
); | |||
$random = \OC::$server->getSecureRandom(); | |||
$logger = \OC::$server->getLogger(); | |||
$dispatcher = \OC::$server->getEventDispatcher(); | |||
$dispatcher = \OC::$server->get(IEventDispatcher::class); | |||
$legacyDispatcher = \OC::$server->getEventDispatcher(); | |||
$name = $input->getArgument('name'); | |||
$caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $this->groupManager, $random, $logger, $dispatcher); | |||
$caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $this->groupManager, $random, $logger, $dispatcher, $legacyDispatcher); | |||
$caldav->createCalendar("principals/users/$user", $name, []); | |||
return 0; | |||
} |
@@ -0,0 +1,72 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class AddressBookCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class AddressBookCreatedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** | |||
* AddressBookCreatedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
} |
@@ -0,0 +1,86 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class AddressBookDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class AddressBookDeletedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $shares; | |||
/** | |||
* AddressBookDeletedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $shares | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $shares) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->shares = $shares; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId():int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
} |
@@ -0,0 +1,114 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class AddressBookShareUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class AddressBookShareUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $oldShares; | |||
/** @var array */ | |||
private $added; | |||
/** @var array */ | |||
private $removed; | |||
/** | |||
* AddressBookShareUpdatedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $oldShares | |||
* @param array $added | |||
* @param array $removed | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $oldShares, | |||
array $added, | |||
array $removed) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->oldShares = $oldShares; | |||
$this->added = $added; | |||
$this->removed = $removed; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getOldShares(): array { | |||
return $this->oldShares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAdded(): array { | |||
return $this->added; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getRemoved(): array { | |||
return $this->removed; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class AddressBookUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class AddressBookUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $mutations; | |||
/** | |||
* AddressBookUpdatedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $shares | |||
* @param array $mutations | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $shares, | |||
array $mutations) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->shares = $shares; | |||
$this->mutations = $mutations; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getMutations(): array { | |||
return $this->mutations; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CachedCalendarObjectCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CachedCalendarObjectCreatedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CachedCalendarObjectCreatedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CachedCalendarObjectDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CachedCalendarObjectDeletedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CachedCalendarObjectDeletedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CachedCalendarObjectUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CachedCalendarObjectUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CachedCalendarObjectUpdatedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarCreatedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** | |||
* CalendarCreatedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
} |
@@ -0,0 +1,86 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarDeletedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $shares; | |||
/** | |||
* CalendarDeletedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $shares | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $shares) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->shares = $shares; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarObjectCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarObjectCreatedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CalendarObjectCreatedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarObjectDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarObjectDeletedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CalendarObjectDeletedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarObjectUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarObjectUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $objectData; | |||
/** | |||
* CalendarObjectUpdatedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $shares | |||
* @param array $objectData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $shares, | |||
array $objectData) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->shares = $shares; | |||
$this->objectData = $objectData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getObjectData(): array { | |||
return $this->objectData; | |||
} | |||
} |
@@ -0,0 +1,86 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarPublishedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarPublishedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var string */ | |||
private $publicUri; | |||
/** | |||
* CalendarPublishedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param string $publicUri | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
string $publicUri) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->publicUri = $publicUri; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return string | |||
* @since 20.0.0 | |||
*/ | |||
public function getPublicUri(): string { | |||
return $this->publicUri; | |||
} | |||
} |
@@ -0,0 +1,114 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarShareUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarShareUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $oldShares; | |||
/** @var array */ | |||
private $added; | |||
/** @var array */ | |||
private $removed; | |||
/** | |||
* CalendarShareUpdatedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $oldShares | |||
* @param array $added | |||
* @param array $removed | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $oldShares, | |||
array $added, | |||
array $removed) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->oldShares = $oldShares; | |||
$this->added = $added; | |||
$this->removed = $removed; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getOldShares(): array { | |||
return $this->oldShares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAdded(): array { | |||
return $this->added; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getRemoved(): array { | |||
return $this->removed; | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarPublishedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarUnpublishedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** | |||
* CalendarUnpublishedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CalendarUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CalendarUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $calendarId; | |||
/** @var array */ | |||
private $calendarData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $mutations; | |||
/** | |||
* CalendarUpdatedEvent constructor. | |||
* | |||
* @param int $calendarId | |||
* @param array $calendarData | |||
* @param array $shares | |||
* @param array $mutations | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $calendarId, | |||
array $calendarData, | |||
array $shares, | |||
array $mutations) { | |||
parent::__construct(); | |||
$this->calendarId = $calendarId; | |||
$this->calendarData = $calendarData; | |||
$this->shares = $shares; | |||
$this->mutations = $mutations; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarId(): int { | |||
return $this->calendarId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCalendarData(): array { | |||
return $this->calendarData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getMutations(): array { | |||
return $this->mutations; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CardCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CardCreatedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $cardData; | |||
/** | |||
* CardCreatedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $shares | |||
* @param array $cardData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $shares, | |||
array $cardData) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->shares = $shares; | |||
$this->cardData = $cardData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCardData(): array { | |||
return $this->cardData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CardDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CardDeletedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $cardData; | |||
/** | |||
* CardDeletedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $shares | |||
* @param array $cardData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $shares, | |||
array $cardData) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->shares = $shares; | |||
$this->cardData = $cardData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCardData(): array { | |||
return $this->cardData; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class CardUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class CardUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $addressBookId; | |||
/** @var array */ | |||
private $addressBookData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $cardData; | |||
/** | |||
* CardUpdatedEvent constructor. | |||
* | |||
* @param int $addressBookId | |||
* @param array $addressBookData | |||
* @param array $shares | |||
* @param array $cardData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $addressBookId, | |||
array $addressBookData, | |||
array $shares, | |||
array $cardData) { | |||
parent::__construct(); | |||
$this->addressBookId = $addressBookId; | |||
$this->addressBookData = $addressBookData; | |||
$this->shares = $shares; | |||
$this->cardData = $cardData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookId(): int { | |||
return $this->addressBookId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getAddressBookData(): array { | |||
return $this->addressBookData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getCardData(): array { | |||
return $this->cardData; | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class SubscriptionCreatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class SubscriptionCreatedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** | |||
* SubscriptionCreatedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
} |
@@ -0,0 +1,86 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class SubscriptionDeletedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class SubscriptionDeletedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** @var array */ | |||
private $shares; | |||
/** | |||
* SubscriptionDeletedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @param array $shares | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData, | |||
array $shares) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
$this->shares = $shares; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
<?php | |||
declare(strict_types=1); | |||
/** | |||
* @copyright Copyright (c) 2020, Georg Ehrke | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Events; | |||
use OCP\EventDispatcher\Event; | |||
/** | |||
* Class SubscriptionUpdatedEvent | |||
* | |||
* @package OCA\DAV\Events | |||
* @since 20.0.0 | |||
*/ | |||
class SubscriptionUpdatedEvent extends Event { | |||
/** @var int */ | |||
private $subscriptionId; | |||
/** @var array */ | |||
private $subscriptionData; | |||
/** @var array */ | |||
private $shares; | |||
/** @var array */ | |||
private $mutations; | |||
/** | |||
* SubscriptionUpdatedEvent constructor. | |||
* | |||
* @param int $subscriptionId | |||
* @param array $subscriptionData | |||
* @param array $shares | |||
* @param array $mutations | |||
* @since 20.0.0 | |||
*/ | |||
public function __construct(int $subscriptionId, | |||
array $subscriptionData, | |||
array $shares, | |||
array $mutations) { | |||
parent::__construct(); | |||
$this->subscriptionId = $subscriptionId; | |||
$this->subscriptionData = $subscriptionData; | |||
$this->shares = $shares; | |||
$this->mutations = $mutations; | |||
} | |||
/** | |||
* @return int | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionId(): int { | |||
return $this->subscriptionId; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getSubscriptionData(): array { | |||
return $this->subscriptionData; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getShares(): array { | |||
return $this->shares; | |||
} | |||
/** | |||
* @return array | |||
* @since 20.0.0 | |||
*/ | |||
public function getMutations(): array { | |||
return $this->mutations; | |||
} | |||
} |
@@ -45,6 +45,7 @@ use OCA\DAV\Provisioning\Apple\AppleProvisioningNode; | |||
use OCA\DAV\Upload\CleanupService; | |||
use OCP\App\IAppManager; | |||
use OCP\AppFramework\Utility\ITimeFactory; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use Sabre\DAV\SimpleCollection; | |||
class RootCollection extends SimpleCollection { | |||
@@ -58,7 +59,8 @@ class RootCollection extends SimpleCollection { | |||
$groupManager = \OC::$server->getGroupManager(); | |||
$shareManager = \OC::$server->getShareManager(); | |||
$db = \OC::$server->getDatabaseConnection(); | |||
$dispatcher = \OC::$server->getEventDispatcher(); | |||
$dispatcher = \OC::$server->get(IEventDispatcher::class); | |||
$legacyDispatcher = \OC::$server->getEventDispatcher(); | |||
$proxyMapper = \OC::$server->query(ProxyMapper::class); | |||
$userPrincipalBackend = new Principal( | |||
@@ -91,14 +93,14 @@ class RootCollection extends SimpleCollection { | |||
$filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users'); | |||
$filesCollection->disableListing = $disableListing; | |||
$caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); | |||
$caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher, $legacyDispatcher); | |||
$userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users'); | |||
$userCalendarRoot->disableListing = $disableListing; | |||
$resourceCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); | |||
$resourceCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher, $legacyDispatcher); | |||
$resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources'); | |||
$resourceCalendarRoot->disableListing = $disableListing; | |||
$roomCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); | |||
$roomCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher, $legacyDispatcher); | |||
$roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $roomCalendarCaldavBackend, 'principals/calendar-rooms'); | |||
$roomCalendarRoot->disableListing = $disableListing; | |||
@@ -126,11 +128,11 @@ class RootCollection extends SimpleCollection { | |||
); | |||
$pluginManager = new PluginManager(\OC::$server, \OC::$server->query(IAppManager::class)); | |||
$usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); | |||
$usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher, $legacyDispatcher); | |||
$usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, $pluginManager, 'principals/users'); | |||
$usersAddressBookRoot->disableListing = $disableListing; | |||
$systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); | |||
$systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher, $legacyDispatcher); | |||
$systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, $pluginManager, 'principals/system'); | |||
$systemAddressBookRoot->disableListing = $disableListing; | |||
@@ -31,6 +31,7 @@ use OCA\DAV\CalDAV\CalDavBackend; | |||
use OCA\DAV\CalDAV\Proxy\ProxyMapper; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCP\App\IAppManager; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IConfig; | |||
use OCP\IGroupManager; | |||
use OCP\ILogger; | |||
@@ -63,6 +64,8 @@ abstract class AbstractCalDavBackend extends TestCase { | |||
protected $groupManager; | |||
/** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ | |||
protected $dispatcher; | |||
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ | |||
protected $legacyDispatcher; | |||
/** @var ISecureRandom */ | |||
private $random; | |||
@@ -79,7 +82,8 @@ abstract class AbstractCalDavBackend extends TestCase { | |||
$this->userManager = $this->createMock(IUserManager::class); | |||
$this->groupManager = $this->createMock(IGroupManager::class); | |||
$this->dispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$this->dispatcher = $this->createMock(IEventDispatcher::class); | |||
$this->legacyDispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$this->principal = $this->getMockBuilder(Principal::class) | |||
->setConstructorArgs([ | |||
$this->userManager, | |||
@@ -104,7 +108,7 @@ abstract class AbstractCalDavBackend extends TestCase { | |||
$db = \OC::$server->getDatabaseConnection(); | |||
$this->random = \OC::$server->getSecureRandom(); | |||
$this->logger = $this->createMock(ILogger::class); | |||
$this->backend = new CalDavBackend($db, $this->principal, $this->userManager, $this->groupManager, $this->random, $this->logger, $this->dispatcher); | |||
$this->backend = new CalDavBackend($db, $this->principal, $this->userManager, $this->groupManager, $this->random, $this->logger, $this->dispatcher, $this->legacyDispatcher); | |||
$this->cleanUpBackend(); | |||
} | |||
@@ -128,7 +132,7 @@ abstract class AbstractCalDavBackend extends TestCase { | |||
private function cleanupForPrincipal($principal): void { | |||
$calendars = $this->backend->getCalendarsForUser($principal); | |||
foreach ($calendars as $calendar) { | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar'); | |||
@@ -141,7 +145,7 @@ abstract class AbstractCalDavBackend extends TestCase { | |||
} | |||
protected function createTestCalendar() { | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendar'); | |||
@@ -198,7 +202,7 @@ END:VCALENDAR | |||
EOD; | |||
$uri0 = $this->getUniqueID('event'); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
@@ -57,7 +57,7 @@ class CalDavBackendTest extends AbstractCalDavBackend { | |||
'{DAV:}displayname' => 'Unit test', | |||
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar used for unit testing' | |||
]); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar'); | |||
$this->backend->updateCalendar($calendarId, $patch); | |||
@@ -70,7 +70,7 @@ class CalDavBackendTest extends AbstractCalDavBackend { | |||
$this->assertEquals('User\'s displayname', $calendars[0]['{http://nextcloud.com/ns}owner-displayname']); | |||
// delete the address book | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar'); | |||
$this->backend->deleteCalendar($calendars[0]['id']); | |||
@@ -148,7 +148,7 @@ class CalDavBackendTest extends AbstractCalDavBackend { | |||
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER); | |||
$this->assertCount(1, $calendars); | |||
$calendar = new Calendar($this->backend, $calendars[0], $l10n, $config); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::updateShares'); | |||
$this->backend->updateShares($calendar, $add, []); | |||
@@ -181,7 +181,7 @@ END:VEVENT | |||
END:VCALENDAR | |||
EOD; | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
$this->backend->createCalendarObject($calendarId, $uri, $calData); | |||
@@ -195,7 +195,7 @@ EOD; | |||
$this->assertAccess($userCanWrite, self::UNIT_TEST_USER1, '{DAV:}write', $acl); | |||
// delete the address book | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar'); | |||
$this->backend->deleteCalendar($calendars[0]['id']); | |||
@@ -225,7 +225,7 @@ END:VEVENT | |||
END:VCALENDAR | |||
EOD; | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
$this->backend->createCalendarObject($calendarId, $uri, $calData); | |||
@@ -263,7 +263,7 @@ DTEND;VALUE=DATE-TIME:20130912T140000Z | |||
END:VEVENT | |||
END:VCALENDAR | |||
EOD; | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject'); | |||
$this->backend->updateCalendarObject($calendarId, $uri, $calData); | |||
@@ -271,7 +271,7 @@ EOD; | |||
$this->assertEquals($calData, $calendarObject['calendardata']); | |||
// delete the card | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject'); | |||
$this->backend->deleteCalendarObject($calendarId, $uri); | |||
@@ -366,17 +366,17 @@ END:VCALENDAR | |||
EOD; | |||
$uri0 = static::getUniqueID('card'); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
$this->backend->createCalendarObject($calendarId, $uri0, $calData[0]); | |||
$uri1 = static::getUniqueID('card'); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
$this->backend->createCalendarObject($calendarId, $uri1, $calData[1]); | |||
$uri2 = static::getUniqueID('card'); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject'); | |||
$this->backend->createCalendarObject($calendarId, $uri2, $calData[2]); | |||
@@ -405,15 +405,15 @@ EOD; | |||
$this->assertEquals($calData[2], $calendarObjects[1]['calendardata']); | |||
// delete the card | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject'); | |||
$this->backend->deleteCalendarObject($calendarId, $uri0); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject'); | |||
$this->backend->deleteCalendarObject($calendarId, $uri1); | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject'); | |||
$this->backend->deleteCalendarObject($calendarId, $uri2); | |||
@@ -498,7 +498,7 @@ EOD; | |||
} | |||
public function testPublications() { | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CalDAV\CalDavBackend::createCalendar'); | |||
@@ -36,6 +36,7 @@ use OCA\DAV\CalDAV\Calendar; | |||
use OCA\DAV\CalDAV\PublicCalendar; | |||
use OCA\DAV\CalDAV\PublicCalendarRoot; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IConfig; | |||
use OCP\IGroupManager; | |||
use OCP\IL10N; | |||
@@ -83,7 +84,8 @@ class PublicCalendarRootTest extends TestCase { | |||
$this->groupManager = $this->createMock(IGroupManager::class); | |||
$this->random = \OC::$server->getSecureRandom(); | |||
$this->logger = $this->createMock(ILogger::class); | |||
$dispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$dispatcher = $this->createMock(IEventDispatcher::class); | |||
$legacyDispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$this->principal->expects($this->any())->method('getGroupMembership') | |||
->withAnyParameters() | |||
@@ -100,7 +102,8 @@ class PublicCalendarRootTest extends TestCase { | |||
$this->groupManager, | |||
$this->random, | |||
$this->logger, | |||
$dispatcher | |||
$dispatcher, | |||
$legacyDispatcher | |||
); | |||
$this->l10n = $this->getMockBuilder(IL10N::class) | |||
->disableOriginalConstructor()->getMock(); |
@@ -39,6 +39,7 @@ use OCA\DAV\CardDAV\CardDavBackend; | |||
use OCA\DAV\Connector\Sabre\Principal; | |||
use OCP\App\IAppManager; | |||
use OCP\DB\QueryBuilder\IQueryBuilder; | |||
use OCP\EventDispatcher\IEventDispatcher; | |||
use OCP\IConfig; | |||
use OCP\IDBConnection; | |||
use OCP\IGroupManager; | |||
@@ -76,6 +77,9 @@ class CardDavBackendTest extends TestCase { | |||
private $groupManager; | |||
/** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ | |||
private $legacyDispatcher; | |||
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ | |||
private $dispatcher; | |||
/** @var IDBConnection */ | |||
@@ -147,11 +151,12 @@ class CardDavBackendTest extends TestCase { | |||
$this->principal->method('getGroupMembership') | |||
->withAnyParameters() | |||
->willReturn([self::UNIT_TEST_GROUP]); | |||
$this->dispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$this->dispatcher = $this->createMock(IEventDispatcher::class); | |||
$this->legacyDispatcher = $this->createMock(EventDispatcherInterface::class); | |||
$this->db = \OC::$server->getDatabaseConnection(); | |||
$this->backend = new CardDavBackend($this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher); | |||
$this->backend = new CardDavBackend($this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher); | |||
// start every test with a empty cards_properties and cards table | |||
$query = $this->db->getQueryBuilder(); | |||
$query->delete('cards_properties')->execute(); | |||
@@ -241,7 +246,7 @@ class CardDavBackendTest extends TestCase { | |||
/** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */ | |||
$backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties', 'purgeProperties'])->getMock(); | |||
// create a new address book | |||
@@ -256,7 +261,7 @@ class CardDavBackendTest extends TestCase { | |||
$backend->expects($this->at(1))->method('updateProperties')->with($bookId, $uri, $this->vcardTest1); | |||
// Expect event | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CardDAV\CardDavBackend::createCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { | |||
return $e->getArgument('addressBookId') === $bookId && | |||
@@ -283,7 +288,7 @@ class CardDavBackendTest extends TestCase { | |||
$this->assertEquals($this->vcardTest0, $card['carddata']); | |||
// Expect event | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { | |||
return $e->getArgument('addressBookId') === $bookId && | |||
@@ -297,7 +302,7 @@ class CardDavBackendTest extends TestCase { | |||
$this->assertEquals($this->vcardTest1, $card['carddata']); | |||
// Expect event | |||
$this->dispatcher->expects($this->at(0)) | |||
$this->legacyDispatcher->expects($this->at(0)) | |||
->method('dispatch') | |||
->with('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { | |||
return $e->getArgument('addressBookId') === $bookId && | |||
@@ -313,7 +318,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testMultiCard() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties'])->getMock(); | |||
// create a new address book | |||
@@ -366,7 +371,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testMultipleUIDOnDifferentAddressbooks() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties'])->getMock(); | |||
// create 2 new address books | |||
@@ -388,7 +393,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testMultipleUIDDenied() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties'])->getMock(); | |||
// create a new address book | |||
@@ -409,7 +414,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testNoValidUID() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties'])->getMock(); | |||
// create a new address book | |||
@@ -426,7 +431,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testDeleteWithoutCard() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods([ | |||
'getCardId', | |||
'addChange', | |||
@@ -466,7 +471,7 @@ class CardDavBackendTest extends TestCase { | |||
public function testSyncSupport() { | |||
$this->backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['updateProperties'])->getMock(); | |||
// create a new address book | |||
@@ -532,7 +537,7 @@ class CardDavBackendTest extends TestCase { | |||
$cardId = 2; | |||
$backend = $this->getMockBuilder(CardDavBackend::class) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) | |||
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher, $this->legacyDispatcher]) | |||
->setMethods(['getCardId'])->getMock(); | |||
$backend->expects($this->any())->method('getCardId')->willReturn($cardId); |