From ed039ee5ebdba6778b245f249fe206d2423a6a36 Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Thu, 29 Oct 2015 17:27:14 +0100 Subject: added app "federation", allows you to connect ownClouds and exchange user lists --- apps/federation/appinfo/app.php | 25 +++++++++ apps/federation/appinfo/application.php | 92 +++++++++++++++++++++++++++++++++ apps/federation/appinfo/database.xml | 43 +++++++++++++++ apps/federation/appinfo/info.xml | 14 +++++ apps/federation/appinfo/routes.php | 35 +++++++++++++ 5 files changed, 209 insertions(+) create mode 100644 apps/federation/appinfo/app.php create mode 100644 apps/federation/appinfo/application.php create mode 100644 apps/federation/appinfo/database.xml create mode 100644 apps/federation/appinfo/info.xml create mode 100644 apps/federation/appinfo/routes.php (limited to 'apps/federation/appinfo') diff --git a/apps/federation/appinfo/app.php b/apps/federation/appinfo/app.php new file mode 100644 index 00000000000..9ed00f23866 --- /dev/null +++ b/apps/federation/appinfo/app.php @@ -0,0 +1,25 @@ + + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * 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 + * + */ + +namespace OCA\Federation\AppInfo; + +$app = new Application(); +$app->registerSettings(); diff --git a/apps/federation/appinfo/application.php b/apps/federation/appinfo/application.php new file mode 100644 index 00000000000..46a791c25d0 --- /dev/null +++ b/apps/federation/appinfo/application.php @@ -0,0 +1,92 @@ + + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * 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 + * + */ + +namespace OCA\Federation\AppInfo; + +use OCA\Federation\Controller\SettingsController; +use OCA\Federation\DbHandler; +use OCA\Federation\Middleware\AddServerMiddleware; +use OCA\Federation\TrustedServers; +use OCP\App; +use OCP\AppFramework\IAppContainer; +use OCP\IAppConfig; + +class Application extends \OCP\AppFramework\App { + + /** + * @param array $urlParams + */ + public function __construct($urlParams = array()) { + parent::__construct('federation', $urlParams); + $this->registerService(); + $this->registerMiddleware(); + + } + + /** + * register setting scripts + */ + public function registerSettings() { + App::registerAdmin('federation', 'settings/settings-admin'); + } + + private function registerService() { + $container = $this->getContainer(); + + $container->registerService('addServerMiddleware', function(IAppContainer $c) { + return new AddServerMiddleware( + $c->getAppName(), + \OC::$server->getL10N($c->getAppName()), + \OC::$server->getLogger() + ); + }); + + $container->registerService('DbHandler', function(IAppContainer $c) { + return new DbHandler( + \OC::$server->getDatabaseConnection(), + \OC::$server->getL10N($c->getAppName()) + ); + }); + + $container->registerService('TrustedServers', function(IAppContainer $c) { + return new TrustedServers( + $c->query('DbHandler'), + \OC::$server->getHTTPClientService(), + \OC::$server->getLogger() + ); + }); + + $container->registerService('SettingsController', function (IAppContainer $c) { + $server = $c->getServer(); + return new SettingsController( + $c->getAppName(), + $server->getRequest(), + $server->getL10N($c->getAppName()), + $c->query('TrustedServers') + ); + }); + } + + private function registerMiddleware() { + $container = $this->getContainer(); + $container->registerMiddleware('addServerMiddleware'); + } +} diff --git a/apps/federation/appinfo/database.xml b/apps/federation/appinfo/database.xml new file mode 100644 index 00000000000..da16212ca19 --- /dev/null +++ b/apps/federation/appinfo/database.xml @@ -0,0 +1,43 @@ + + + *dbname* + true + false + utf8 + + *dbprefix*trusted_servers + + + id + integer + 0 + true + 1 + 4 + + + url + text + true + 512 + Url of trusted server + + + url_hash + text + + true + 32 + md5 hash of the url + + + url_hash + true + + url_hash + ascending + + + +
+
diff --git a/apps/federation/appinfo/info.xml b/apps/federation/appinfo/info.xml new file mode 100644 index 00000000000..53b2926ba53 --- /dev/null +++ b/apps/federation/appinfo/info.xml @@ -0,0 +1,14 @@ + + + federation + Federation + ownCloud Federation allows you to connect with other trusted ownClouds to exchange the user directory. For example this will be used to auto-complete external users for federated sharing. + AGPL + Bjoern Schiessle + 0.0.1 + Federation + other + + + + diff --git a/apps/federation/appinfo/routes.php b/apps/federation/appinfo/routes.php new file mode 100644 index 00000000000..43ccc4ed504 --- /dev/null +++ b/apps/federation/appinfo/routes.php @@ -0,0 +1,35 @@ + + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 +* + * 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 + * + */ + +return [ + 'routes' => [ + [ + 'name' => 'Settings#addServer', + 'url' => '/trusted-servers', + 'verb' => 'POST' + ], + [ + 'name' => 'Settings#removeServer', + 'url' => '/trusted-servers/{id}', + 'verb' => 'DELETE' + ], + ] +]; -- cgit v1.2.3