88 */
99namespace OCA \DAV \CalDAV ;
1010
11+ use OCA \DAV \Db \Property ;
12+ use OCA \DAV \Db \PropertyMapper ;
1113use OCP \Calendar \ICalendarProvider ;
1214use OCP \IConfig ;
1315use OCP \IL10N ;
@@ -20,6 +22,7 @@ public function __construct(
2022 private IL10N $ l10n ,
2123 private IConfig $ config ,
2224 private LoggerInterface $ logger ,
25+ private PropertyMapper $ propertyMapper ,
2326 ) {
2427 }
2528
@@ -35,6 +38,7 @@ public function getCalendars(string $principalUri, array $calendarUris = []): ar
3538
3639 $ iCalendars = [];
3740 foreach ($ calendarInfos as $ calendarInfo ) {
41+ $ calendarInfo = array_merge ($ calendarInfo , $ this ->getAdditionalProperties ($ calendarInfo ['principaluri ' ], $ calendarInfo ['uri ' ]));
3842 $ calendar = new Calendar ($ this ->calDavBackend , $ calendarInfo , $ this ->l10n , $ this ->config , $ this ->logger );
3943 $ iCalendars [] = new CalendarImpl (
4044 $ calendar ,
@@ -44,4 +48,23 @@ public function getCalendars(string $principalUri, array $calendarUris = []): ar
4448 }
4549 return $ iCalendars ;
4650 }
51+
52+ public function getAdditionalProperties (string $ principalUri , string $ calendarUri ): array {
53+ $ user = str_replace ('principals/users/ ' , '' , $ principalUri );
54+ $ path = 'calendars/ ' . $ user . '/ ' . $ calendarUri ;
55+
56+ $ properties = $ this ->propertyMapper ->findPropertiesByPath ($ user , $ path );
57+
58+ $ list = [];
59+ foreach ($ properties as $ property ) {
60+ if ($ property instanceof Property) {
61+ $ list [$ property ->getPropertyname ()] = match ($ property ->getPropertyname ()) {
62+ '{http://owncloud.org/ns}calendar-enabled ' => (bool )$ property ->getPropertyvalue (),
63+ default => $ property ->getPropertyvalue ()
64+ };
65+ }
66+ }
67+
68+ return $ list ;
69+ }
4770}
0 commit comments