summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-01-27 12:52:17 +0100
committerRobin Appelman <robin@icewind.nl>2017-02-08 15:17:02 +0100
commitfa49c4a13b6c5455b13ad44cfc158b271aa9b616 (patch)
tree1014b6de1bd3761e2e26467c78c6f5fd4697ea56 /lib/public
parent1a591cea97313b8500154d6c2c9ce3aaf2f38a88 (diff)
downloadnextcloud-server-fa49c4a13b6c5455b13ad44cfc158b271aa9b616.tar.gz
nextcloud-server-fa49c4a13b6c5455b13ad44cfc158b271aa9b616.zip
Add a single public api for resolving a cloud id to a user and remote and back
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Federation/ICloudId.php58
-rw-r--r--lib/public/Federation/ICloudIdManager.php55
-rw-r--r--lib/public/IServerContainer.php6
3 files changed, 119 insertions, 0 deletions
diff --git a/lib/public/Federation/ICloudId.php b/lib/public/Federation/ICloudId.php
new file mode 100644
index 00000000000..0985544fee8
--- /dev/null
+++ b/lib/public/Federation/ICloudId.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Federation;
+
+/**
+ * Parsed federated cloud id
+ *
+ * @since 12.0.0
+ */
+interface ICloudId {
+ /**
+ * The remote cloud id
+ *
+ * @return string
+ * @since 12.0.0
+ */
+ public function getId();
+
+ /**
+ * Get a clean representation of the cloud id for display
+ *
+ * @return string
+ * @since 12.0.0
+ */
+ public function getDisplayId();
+
+ /**
+ * The username on the remote server
+ *
+ * @return string
+ * @since 12.0.0
+ */
+ public function getUser();
+
+ /**
+ * The base address of the remote server
+ *
+ * @return string
+ * @since 12.0.0
+ */
+ public function getRemote();
+} \ No newline at end of file
diff --git a/lib/public/Federation/ICloudIdManager.php b/lib/public/Federation/ICloudIdManager.php
new file mode 100644
index 00000000000..a81a4af6186
--- /dev/null
+++ b/lib/public/Federation/ICloudIdManager.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Federation;
+
+/**
+ * Interface for resolving federated cloud ids
+ *
+ * @since 12.0.0
+ */
+interface ICloudIdManager {
+ /**
+ * @param string $cloudId
+ * @return ICloudId
+ *
+ * @since 12.0.0
+ */
+ public function resolveCloudId($cloudId);
+
+ /**
+ * Get the cloud id for a remote user
+ *
+ * @param string $user
+ * @param string $remote
+ * @return ICloudId
+ *
+ * @since 12.0.0
+ */
+ public function getCloudId($user, $remote);
+
+ /**
+ * Check if the input is a correctly formatted cloud id
+ *
+ * @param string $cloudId
+ * @return bool
+ *
+ * @since 12.0.0
+ */
+ public function isValidCloudId($cloudId);
+} \ No newline at end of file
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 87628be01f7..02a092ea660 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -525,4 +525,10 @@ interface IServerContainer {
* @since 8.0.0
*/
public function getDateTimeFormatter();
+
+ /**
+ * @return \OCP\Federation\ICloudIdManager
+ * @since 12.0.0
+ */
+ public function getCloudIdManager();
}