diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-03 15:14:22 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-10-14 15:38:34 +0200 |
commit | 13b1b45ee4bab5b832ca3a1602b4c4fb6d391f86 (patch) | |
tree | 3f8d7ef142cdc98472d883bbb18d94dbde57a939 /settings/application.php | |
parent | 766314a6be5a24a4bd7d503d9c44998c13fe348b (diff) | |
download | nextcloud-server-13b1b45ee4bab5b832ca3a1602b4c4fb6d391f86.tar.gz nextcloud-server-13b1b45ee4bab5b832ca3a1602b4c4fb6d391f86.zip |
Refactor MailSettings controller
- Do not store the password (fixes https://github.com/owncloud/core/issues/11385)
- Refactor to AppFramework
- Add unit tests
Conflicts:
settings/admin/controller.php
Diffstat (limited to 'settings/application.php')
-rw-r--r-- | settings/application.php | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/settings/application.php b/settings/application.php new file mode 100644 index 00000000000..b17ca01c2f3 --- /dev/null +++ b/settings/application.php @@ -0,0 +1,70 @@ +<?php +/** + * @author Lukas Reschke + * @copyright 2014 Lukas Reschke lukas@owncloud.com + * + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Settings; + +use OC\AppFramework\Utility\SimpleContainer; +use OC\Settings\Controller\MailSettingsController; +use \OCP\AppFramework\App; +use \OCP\Util; + +/** + * @package OC\Settings + */ +class Application extends App { + + + /** + * @param array $urlParams + */ + public function __construct(array $urlParams=array()){ + parent::__construct('settings', $urlParams); + + $container = $this->getContainer(); + + /** + * Controllers + */ + $container->registerService('MailSettingsController', function(SimpleContainer $c) { + return new MailSettingsController( + $c->query('AppName'), + $c->query('Request'), + $c->query('L10N'), + $c->query('Config'), + $c->query('UserSession'), + $c->query('Defaults'), + $c->query('Mail'), + $c->query('DefaultMailAddress') + ); + }); + + /** + * Core class wrappers + */ + $container->registerService('Config', function(SimpleContainer $c) { + return $c->query('ServerContainer')->getConfig(); + }); + $container->registerService('L10N', function(SimpleContainer $c) { + return $c->query('ServerContainer')->getL10N('settings'); + }); + $container->registerService('UserSession', function(SimpleContainer $c) { + return $c->query('ServerContainer')->getUserSession(); + }); + $container->registerService('Mail', function(SimpleContainer $c) { + return new \OC_Mail; + }); + $container->registerService('Defaults', function(SimpleContainer $c) { + return new \OC_Defaults; + }); + $container->registerService('DefaultMailAddress', function(SimpleContainer $c) { + return Util::getDefaultEmailAddress('no-reply'); + }); + } +} |