summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-29 06:51:49 +0200
committerGitHub <noreply@github.com>2018-06-29 06:51:49 +0200
commit89b6ee1a45f165346ddcc9120195714087287b47 (patch)
treea7951e212e099f08cd28b412aaa03b1fe1757523 /lib/public
parente6780c4fc7fe0bb6ee6d2a8d4bfb2ca09d6e726a (diff)
parentab43251a45f9b04a1681a0b206d85676232dd7c3 (diff)
downloadnextcloud-server-89b6ee1a45f165346ddcc9120195714087287b47.tar.gz
nextcloud-server-89b6ee1a45f165346ddcc9120195714087287b47.zip
Merge pull request #9773 from nextcloud/feature/noid/resource_booking
resource booking
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Calendar/BackendTemporarilyUnavailableException.php32
-rw-r--r--lib/public/Calendar/Resource/IBackend.php70
-rw-r--r--lib/public/Calendar/Resource/IManager.php71
-rw-r--r--lib/public/Calendar/Resource/IResource.php80
-rw-r--r--lib/public/Calendar/Room/IBackend.php70
-rw-r--r--lib/public/Calendar/Room/IManager.php71
-rw-r--r--lib/public/Calendar/Room/IRoom.php80
-rw-r--r--lib/public/IServerContainer.php18
8 files changed, 492 insertions, 0 deletions
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.
*