diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-05-28 20:12:13 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-06-25 04:58:07 +0200 |
commit | 2da510af0b537e3bef7d0563eff828bade51fcbd (patch) | |
tree | a5e5d3ec9884ba47853bf87577a546110a718cd2 /apps/dav/lib/RootCollection.php | |
parent | 29b777e7d1d26a3b75b0aabcca394170e6043939 (diff) | |
download | nextcloud-server-2da510af0b537e3bef7d0563eff828bade51fcbd.tar.gz nextcloud-server-2da510af0b537e3bef7d0563eff828bade51fcbd.zip |
add resource / room principals
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/RootCollection.php')
-rw-r--r-- | apps/dav/lib/RootCollection.php | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index b9f381b4b92..787e869770b 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -27,6 +27,8 @@ namespace OCA\DAV; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\CalendarRoot; use OCA\DAV\CalDAV\PublicCalendarRoot; +use OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend; +use OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend; use OCA\DAV\CardDAV\AddressBookRoot; use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\Connector\Sabre\Principal; @@ -43,6 +45,7 @@ class RootCollection extends SimpleCollection { $random = \OC::$server->getSecureRandom(); $logger = \OC::$server->getLogger(); $userManager = \OC::$server->getUserManager(); + $userSession = \OC::$server->getUserSession(); $groupManager = \OC::$server->getGroupManager(); $shareManager = \OC::$server->getShareManager(); $db = \OC::$server->getDatabaseConnection(); @@ -55,6 +58,8 @@ class RootCollection extends SimpleCollection { $config ); $groupPrincipalBackend = new GroupPrincipalBackend($groupManager); + $calendarResourcePrincipalBackend = new ResourcePrincipalBackend($db, $userSession, $groupManager); + $calendarRoomPrincipalBackend = new RoomPrincipalBackend($db, $userSession, $groupManager); // as soon as debug mode is enabled we allow listing of principals $disableListing = !$config->getSystemValue('debug', false); @@ -65,11 +70,25 @@ class RootCollection extends SimpleCollection { $groupPrincipals->disableListing = $disableListing; $systemPrincipals = new Collection(new SystemPrincipalBackend(), 'principals/system'); $systemPrincipals->disableListing = $disableListing; + $calendarResourcePrincipals = new Collection($calendarResourcePrincipalBackend, 'principals/calendar-resources'); + $calendarResourcePrincipals->disableListing = $disableListing; + $calendarRoomPrincipals = new Collection($calendarRoomPrincipalBackend, 'principals/calendar-rooms'); + $calendarRoomPrincipals->disableListing = $disableListing; + + $filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users'); $filesCollection->disableListing = $disableListing; $caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); - $calendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users'); - $calendarRoot->disableListing = $disableListing; + $userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users'); + $userCalendarRoot->disableListing = $disableListing; + + $resourceCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); + $resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources'); + $resourceCalendarRoot->disableListing = $disableListing; + $roomCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); + $roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $roomCalendarCaldavBackend, 'principals/calendar-rooms'); + $roomCalendarRoot->disableListing = $disableListing; + $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config); $publicCalendarRoot->disableListing = $disableListing; @@ -111,9 +130,15 @@ class RootCollection extends SimpleCollection { new SimpleCollection('principals', [ $userPrincipals, $groupPrincipals, - $systemPrincipals]), + $systemPrincipals, + $calendarResourcePrincipals, + $calendarRoomPrincipals]), $filesCollection, - $calendarRoot, + $userCalendarRoot, + new SimpleCollection('system-calendars', [ + $resourceCalendarRoot, + $roomCalendarRoot, + ]), $publicCalendarRoot, new SimpleCollection('addressbooks', [ $usersAddressBookRoot, |