You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CachedSubscriptionObject.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018 Georg Ehrke <oc.list@georgehrke.com>
  5. *
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCA\DAV\CalDAV;
  26. use Sabre\DAV\Exception\MethodNotAllowed;
  27. /**
  28. * Class CachedSubscriptionObject
  29. *
  30. * @package OCA\DAV\CalDAV
  31. * @property CalDavBackend $caldavBackend
  32. */
  33. class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject {
  34. /**
  35. * @inheritdoc
  36. */
  37. public function get() {
  38. // Pre-populating the 'calendardata' is optional, if we don't have it
  39. // already we fetch it from the backend.
  40. if (!isset($this->objectData['calendardata'])) {
  41. $this->objectData = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $this->objectData['uri'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
  42. }
  43. return $this->objectData['calendardata'];
  44. }
  45. /**
  46. * @param resource|string $calendarData
  47. * @return string|void
  48. * @throws MethodNotAllowed
  49. */
  50. public function put($calendarData) {
  51. throw new MethodNotAllowed('Creating objects in a cached subscription is not allowed');
  52. }
  53. /**
  54. * @throws MethodNotAllowed
  55. */
  56. public function delete() {
  57. throw new MethodNotAllowed('Deleting objects in a cached subscription is not allowed');
  58. }
  59. }