diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-06-29 06:51:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 06:51:49 +0200 |
commit | 89b6ee1a45f165346ddcc9120195714087287b47 (patch) | |
tree | a7951e212e099f08cd28b412aaa03b1fe1757523 /lib | |
parent | e6780c4fc7fe0bb6ee6d2a8d4bfb2ca09d6e726a (diff) | |
parent | ab43251a45f9b04a1681a0b206d85676232dd7c3 (diff) | |
download | nextcloud-server-89b6ee1a45f165346ddcc9120195714087287b47.tar.gz nextcloud-server-89b6ee1a45f165346ddcc9120195714087287b47.zip |
Merge pull request #9773 from nextcloud/feature/noid/resource_booking
resource booking
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 9 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 9 | ||||
-rw-r--r-- | lib/private/Calendar/Resource/Manager.php | 83 | ||||
-rw-r--r-- | lib/private/Calendar/Room/Manager.php | 83 | ||||
-rw-r--r-- | lib/private/Server.php | 20 | ||||
-rw-r--r-- | lib/public/Calendar/BackendTemporarilyUnavailableException.php | 32 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IBackend.php | 70 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IManager.php | 71 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IResource.php | 80 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IBackend.php | 70 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IManager.php | 71 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IRoom.php | 80 | ||||
-rw-r--r-- | lib/public/IServerContainer.php | 18 |
13 files changed, 696 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index d0ff57de552..b416d6e77bd 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -77,8 +77,15 @@ return array( 'OCP\\BackgroundJob' => $baseDir . '/lib/public/BackgroundJob.php', 'OCP\\BackgroundJob\\IJob' => $baseDir . '/lib/public/BackgroundJob/IJob.php', 'OCP\\BackgroundJob\\IJobList' => $baseDir . '/lib/public/BackgroundJob/IJobList.php', + 'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php', 'OCP\\Calendar\\ICalendar' => $baseDir . '/lib/public/Calendar/ICalendar.php', 'OCP\\Calendar\\IManager' => $baseDir . '/lib/public/Calendar/IManager.php', + 'OCP\\Calendar\\Resource\\IBackend' => $baseDir . '/lib/public/Calendar/Resource/IBackend.php', + 'OCP\\Calendar\\Resource\\IManager' => $baseDir . '/lib/public/Calendar/Resource/IManager.php', + 'OCP\\Calendar\\Resource\\IResource' => $baseDir . '/lib/public/Calendar/Resource/IResource.php', + 'OCP\\Calendar\\Room\\IBackend' => $baseDir . '/lib/public/Calendar/Room/IBackend.php', + 'OCP\\Calendar\\Room\\IManager' => $baseDir . '/lib/public/Calendar/Room/IManager.php', + 'OCP\\Calendar\\Room\\IRoom' => $baseDir . '/lib/public/Calendar/Room/IRoom.php', 'OCP\\Capabilities\\ICapability' => $baseDir . '/lib/public/Capabilities/ICapability.php', 'OCP\\Capabilities\\IPublicCapability' => $baseDir . '/lib/public/Capabilities/IPublicCapability.php', 'OCP\\Collaboration\\AutoComplete\\IManager' => $baseDir . '/lib/public/Collaboration/AutoComplete/IManager.php', @@ -446,6 +453,8 @@ return array( 'OC\\Cache\\CappedMemoryCache' => $baseDir . '/lib/private/Cache/CappedMemoryCache.php', 'OC\\Cache\\File' => $baseDir . '/lib/private/Cache/File.php', 'OC\\Calendar\\Manager' => $baseDir . '/lib/private/Calendar/Manager.php', + 'OC\\Calendar\\Resource\\Manager' => $baseDir . '/lib/private/Calendar/Resource/Manager.php', + 'OC\\Calendar\\Room\\Manager' => $baseDir . '/lib/private/Calendar/Room/Manager.php', 'OC\\CapabilitiesManager' => $baseDir . '/lib/private/CapabilitiesManager.php', 'OC\\Collaboration\\AutoComplete\\Manager' => $baseDir . '/lib/private/Collaboration/AutoComplete/Manager.php', 'OC\\Collaboration\\Collaborators\\GroupPlugin' => $baseDir . '/lib/private/Collaboration/Collaborators/GroupPlugin.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 3d5a6536c65..2ada951e03e 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -107,8 +107,15 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\BackgroundJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob.php', 'OCP\\BackgroundJob\\IJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/IJob.php', 'OCP\\BackgroundJob\\IJobList' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/IJobList.php', + 'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php', 'OCP\\Calendar\\ICalendar' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendar.php', 'OCP\\Calendar\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/IManager.php', + 'OCP\\Calendar\\Resource\\IBackend' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IBackend.php', + 'OCP\\Calendar\\Resource\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IManager.php', + 'OCP\\Calendar\\Resource\\IResource' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IResource.php', + 'OCP\\Calendar\\Room\\IBackend' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IBackend.php', + 'OCP\\Calendar\\Room\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IManager.php', + 'OCP\\Calendar\\Room\\IRoom' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IRoom.php', 'OCP\\Capabilities\\ICapability' => __DIR__ . '/../../..' . '/lib/public/Capabilities/ICapability.php', 'OCP\\Capabilities\\IPublicCapability' => __DIR__ . '/../../..' . '/lib/public/Capabilities/IPublicCapability.php', 'OCP\\Collaboration\\AutoComplete\\IManager' => __DIR__ . '/../../..' . '/lib/public/Collaboration/AutoComplete/IManager.php', @@ -476,6 +483,8 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Cache\\CappedMemoryCache' => __DIR__ . '/../../..' . '/lib/private/Cache/CappedMemoryCache.php', 'OC\\Cache\\File' => __DIR__ . '/../../..' . '/lib/private/Cache/File.php', 'OC\\Calendar\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Manager.php', + 'OC\\Calendar\\Resource\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Resource/Manager.php', + 'OC\\Calendar\\Room\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Room/Manager.php', 'OC\\CapabilitiesManager' => __DIR__ . '/../../..' . '/lib/private/CapabilitiesManager.php', 'OC\\Collaboration\\AutoComplete\\Manager' => __DIR__ . '/../../..' . '/lib/private/Collaboration/AutoComplete/Manager.php', 'OC\\Collaboration\\Collaborators\\GroupPlugin' => __DIR__ . '/../../..' . '/lib/private/Collaboration/Collaborators/GroupPlugin.php', diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php new file mode 100644 index 00000000000..2d1746cb989 --- /dev/null +++ b/lib/private/Calendar/Resource/Manager.php @@ -0,0 +1,83 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Calendar\Resource; + +use OCP\Calendar\Resource\IBackend; + +class Manager implements \OCP\Calendar\Resource\IManager { + + /** @var IBackend[] holds all registered resource backends */ + private $backends; + + /** + * Registers a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend) { + $this->backends[$backend->getBackendIdentifier()] = $backend; + } + + /** + * Unregisters a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend) { + unset($this->backends[$backend->getBackendIdentifier()]); + } + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array { + return array_values($this->backends); + } + + /** + * @param string $backendId + * @return IBackend|null + */ + public function getBackend($backendId):IBackend { + if (!isset($this->backends[$backendId])) { + return null; + } + + return $this->backends[$backendId]; + } + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear() { + $this->backends = []; + } +} diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php new file mode 100644 index 00000000000..9ddf1f1d7b7 --- /dev/null +++ b/lib/private/Calendar/Room/Manager.php @@ -0,0 +1,83 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Calendar\Room; + +use OCP\Calendar\Room\IBackend; + +class Manager implements \OCP\Calendar\Room\IManager { + + /** @var IBackend[] holds all registered resource backends */ + private $backends; + + /** + * Registers a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend) { + $this->backends[$backend->getBackendIdentifier()] = $backend; + } + + /** + * Unregisters a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend) { + unset($this->backends[$backend->getBackendIdentifier()]); + } + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array { + return array_values($this->backends); + } + + /** + * @param string $backendId + * @return IBackend|null + */ + public function getBackend($backendId):IBackend { + if (!isset($this->backends[$backendId])) { + return null; + } + + return $this->backends[$backendId]; + } + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear() { + $this->backends = []; + } +} diff --git a/lib/private/Server.php b/lib/private/Server.php index 7824638b212..3c15873206d 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -174,6 +174,12 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class); $this->registerAlias('CalendarManager', \OC\Calendar\Manager::class); + $this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class); + $this->registerAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class); + + $this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class); + $this->registerAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class); + $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class); $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class); @@ -1163,6 +1169,20 @@ class Server extends ServerContainer implements IServerContainer { return $this->query('CalendarManager'); } + /** + * @return \OCP\Calendar\Resource\IManager + */ + public function getCalendarResourceBackendManager() { + return $this->query('CalendarResourceBackendManager'); + } + + /** + * @return \OCP\Calendar\Room\IManager + */ + public function getCalendarRoomBackendManager() { + return $this->query('CalendarRoomBackendManager'); + } + private function connectDispatcher() { $dispatcher = $this->getEventDispatcher(); diff --git a/lib/public/Calendar/BackendTemporarilyUnavailableException.php b/lib/public/Calendar/BackendTemporarilyUnavailableException.php new file mode 100644 index 00000000000..632a802359c --- /dev/null +++ b/lib/public/Calendar/BackendTemporarilyUnavailableException.php @@ -0,0 +1,32 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar; + +/** + * Class BackendTemporarilyUnavailableException + * + * @package OCP\Calendar + * @since 14.0.0 + */ +class BackendTemporarilyUnavailableException extends \Exception {} diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php new file mode 100644 index 00000000000..24635219fe0 --- /dev/null +++ b/lib/public/Calendar/Resource/IBackend.php @@ -0,0 +1,70 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Resource; +use OCP\Calendar\BackendTemporarilyUnavailableException; + +/** + * Interface IBackend + * + * @package OCP\Calendar\Resource + * @since 14.0.0 + */ +interface IBackend { + + /** + * get a list of all resources in this backend + * + * @throws BackendTemporarilyUnavailableException + * @return IResource[] + * @since 14.0.0 + */ + public function getAllResources():array; + + /** + * get a list of all resource identifiers in this backend + * + * @throws BackendTemporarilyUnavailableException + * @return string[] + * @since 14.0.0 + */ + public function listAllResources():array; + + /** + * get a resource by it's id + * + * @param string $id + * @throws BackendTemporarilyUnavailableException + * @return IResource|null + * @since 14.0.0 + */ + public function getResource($id); + + /** + * Get unique identifier of the backend + * + * @return string + * @since 14.0.0 + */ + public function getBackendIdentifier():string; +} diff --git a/lib/public/Calendar/Resource/IManager.php b/lib/public/Calendar/Resource/IManager.php new file mode 100644 index 00000000000..8542e13eba7 --- /dev/null +++ b/lib/public/Calendar/Resource/IManager.php @@ -0,0 +1,71 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Resource; + +/** + * Interface IManager + * + * @package OCP\Calendar\Resource + * @since 14.0.0 + */ +interface IManager { + + /** + * Registers a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend); + + /** + * Unregisters a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend); + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array; + + /** + * @param string $backendId + * @return IBackend + * @since 14.0.0 + */ + public function getBackend($backendId):IBackend; + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear(); +} diff --git a/lib/public/Calendar/Resource/IResource.php b/lib/public/Calendar/Resource/IResource.php new file mode 100644 index 00000000000..1f588ccb48d --- /dev/null +++ b/lib/public/Calendar/Resource/IResource.php @@ -0,0 +1,80 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Resource; + +/** + * Interface IResource + * + * @package OCP\Calendar\Resource + * @since 14.0.0 + */ +interface IResource { + + /** + * get the resource id + * + * This id has to be unique within the backend + * + * @return string + * @since 14.0.0 + */ + public function getId():string; + + /** + * get the display name for a resource + * + * @return string + * @since 14.0.0 + */ + public function getDisplayName():string; + + /** + * Get a list of groupIds that are allowed to access this resource + * + * If an empty array is returned, no group restrictions are + * applied. + * + * @return string[] + * @since 14.0.0 + */ + public function getGroupRestrictions():array; + + /** + * get email-address for resource + * + * The email address has to be globally unique + * + * @return string + * @since 14.0.0 + */ + public function getEMail():string; + + /** + * Get corresponding backend object + * + * @return IBackend + * @since 14.0.0 + */ + public function getBackend():IBackend; +} diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php new file mode 100644 index 00000000000..f675012ab39 --- /dev/null +++ b/lib/public/Calendar/Room/IBackend.php @@ -0,0 +1,70 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Room; +use OCP\Calendar\BackendTemporarilyUnavailableException; + +/** + * Interface IBackend + * + * @package OCP\Calendar\Room + * @since 14.0.0 + */ +interface IBackend { + + /** + * get a list of all rooms in this backend + * + * @throws BackendTemporarilyUnavailableException + * @return IRoom[] + * @since 14.0.0 + */ + public function getAllRooms():array; + + /** + * get a list of all room identifiers in this backend + * + * @throws BackendTemporarilyUnavailableException + * @return string[] + * @since 14.0.0 + */ + public function listAllRooms():array; + + /** + * get a room by it's id + * + * @param string $id + * @throws BackendTemporarilyUnavailableException + * @return IRoom|null + * @since 14.0.0 + */ + public function getRoom($id); + + /** + * Get unique identifier of the backend + * + * @return string + * @since 14.0.0 + */ + public function getBackendIdentifier():string; +} diff --git a/lib/public/Calendar/Room/IManager.php b/lib/public/Calendar/Room/IManager.php new file mode 100644 index 00000000000..39e85c43e45 --- /dev/null +++ b/lib/public/Calendar/Room/IManager.php @@ -0,0 +1,71 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Room; + +/** + * Interface IManager + * + * @package OCP\Calendar\Room + * @since 14.0.0 + */ +interface IManager { + + /** + * Registers a room backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend); + + /** + * Unregisters a room backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend); + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array; + + /** + * @param string $backendId + * @return IBackend + * @since 14.0.0 + */ + public function getBackend($backendId):IBackend; + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear(); +} diff --git a/lib/public/Calendar/Room/IRoom.php b/lib/public/Calendar/Room/IRoom.php new file mode 100644 index 00000000000..d860bb6fc57 --- /dev/null +++ b/lib/public/Calendar/Room/IRoom.php @@ -0,0 +1,80 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar\Room; + +/** + * Interface IRoom + * + * @package OCP\Calendar\Room + * @since 14.0.0 + */ +interface IRoom { + + /** + * get the room id + * + * This id has to be unique within the backend + * + * @return string + * @since 14.0.0 + */ + public function getId():string; + + /** + * get the display name for a room + * + * @return string + * @since 14.0.0 + */ + public function getDisplayName():string; + + /** + * Get a list of groupIds that are allowed to access this room + * + * If an empty array is returned, no group restrictions are + * applied. + * + * @return string[] + * @since 14.0.0 + */ + public function getGroupRestrictions():array; + + /** + * get email-address for room + * + * The email address has to be globally unique + * + * @return string + * @since 14.0.0 + */ + public function getEMail():string; + + /** + * Get corresponding backend object + * + * @return IBackend + * @since 14.0.0 + */ + public function getBackend():IBackend; +} diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php index c38aaf9f2cb..96015d3f8a8 100644 --- a/lib/public/IServerContainer.php +++ b/lib/public/IServerContainer.php @@ -68,6 +68,24 @@ interface IServerContainer extends IContainer { public function getCalendarManager(); /** + * The calendar resource backend manager will act as a broker between consumers + * for calendar resource information an providers which actual deliver the room information. + * + * @return \OCP\Calendar\Resource\IBackend + * @since 14.0.0 + */ + public function getCalendarResourceBackendManager(); + + /** + * The calendar room backend manager will act as a broker between consumers + * for calendar room information an providers which actual deliver the room information. + * + * @return \OCP\Calendar\Room\IBackend + * @since 14.0.0 + */ + public function getCalendarRoomBackendManager(); + + /** * The contacts manager will act as a broker between consumers for contacts information and * providers which actual deliver the contact information. * |