summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php98
1 files changed, 82 insertions, 16 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index c21ff650b24..7724feb551b 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -50,6 +50,7 @@ use OC\AppFramework\Utility\SimpleContainer;
use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\LoginCredentials\Store;
use OC\Command\AsyncBus;
+use OC\Contacts\ContactsMenu\ActionFactory;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\NullEventLogger;
use OC\Diagnostics\NullQueryLogger;
@@ -77,6 +78,7 @@ use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Memcache\Factory;
use OC\Notification\Manager;
+use OC\OCS\DiscoveryService;
use OC\Repair\NC11\CleanPreviewsBackgroundJob;
use OC\RichObjectStrings\Validator;
use OC\Security\Bruteforce\Throttler;
@@ -92,9 +94,14 @@ use OC\Security\CredentialsManager;
use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Session\CryptoWrapper;
+use OC\Share20\ShareHelper;
use OC\Tagging\TagMapper;
+use OC\Template\SCSSCacher;
use OCA\Theming\ThemingDefaults;
+
use OCP\App\IAppManager;
+use OCP\Defaults;
+use OCA\Theming\Util;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\ICacheFactory;
@@ -102,8 +109,11 @@ use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IServerContainer;
use OCP\ITempManager;
+use OCP\Contacts\ContactsMenu\IActionFactory;
+use OCP\IURLGenerator;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
+use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -126,9 +136,17 @@ class Server extends ServerContainer implements IServerContainer {
parent::__construct();
$this->webRoot = $webRoot;
+ $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) {
+ return $c;
+ });
+
$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
+ $this->registerAlias(IActionFactory::class, ActionFactory::class);
+
+
+
$this->registerService(\OCP\IPreview::class, function (Server $c) {
return new PreviewManager(
$c->getConfig(),
@@ -171,7 +189,11 @@ class Server extends ServerContainer implements IServerContainer {
$c->getGroupManager(),
$c->getConfig()
);
- return new Encryption\File($util);
+ return new Encryption\File(
+ $util,
+ $c->getRootFolder(),
+ $c->getShareManager()
+ );
});
$this->registerService('EncryptionKeyStorage', function (Server $c) {
@@ -307,7 +329,7 @@ class Server extends ServerContainer implements IServerContainer {
$defaultTokenProvider = null;
}
- $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom());
+ $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager());
$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
});
@@ -341,9 +363,9 @@ class Server extends ServerContainer implements IServerContainer {
$userSession->listen('\OC\User', 'logout', function () {
\OC_Hook::emit('OC_User', 'logout', array());
});
- $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) {
+ $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value));
+ \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
});
return $userSession;
});
@@ -353,13 +375,7 @@ class Server extends ServerContainer implements IServerContainer {
return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger());
});
- $this->registerService(\OCP\INavigationManager::class, function (Server $c) {
- return new \OC\NavigationManager($c->getAppManager(),
- $c->getURLGenerator(),
- $c->getL10NFactory(),
- $c->getUserSession(),
- $c->getGroupManager());
- });
+ $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
$this->registerService(\OC\AllConfig::class, function (Server $c) {
@@ -520,6 +536,21 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerAlias('Search', \OCP\ISearch::class);
+ $this->registerService(\OC\Security\RateLimiting\Limiter::class, function($c) {
+ return new \OC\Security\RateLimiting\Limiter(
+ $this->getUserSession(),
+ $this->getRequest(),
+ new \OC\AppFramework\Utility\TimeFactory(),
+ $c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
+ );
+ });
+ $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) {
+ return new \OC\Security\RateLimiting\Backend\MemoryCache(
+ $this->getMemCacheFactory(),
+ new \OC\AppFramework\Utility\TimeFactory()
+ );
+ });
+
$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
return new SecureRandom();
});
@@ -732,7 +763,9 @@ class Server extends ServerContainer implements IServerContainer {
return new Mailer(
$c->getConfig(),
$c->getLogger(),
- $c->getThemingDefaults()
+ $c->query(Defaults::class),
+ $c->getURLGenerator(),
+ $c->getL10N('lib')
);
});
$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
@@ -829,12 +862,26 @@ class Server extends ServerContainer implements IServerContainer {
$c->getL10N('theming'),
$c->getURLGenerator(),
new \OC_Defaults(),
- $c->getLazyRootFolder(),
- $c->getMemCacheFactory()
+ $c->getAppDataDir('theming'),
+ $c->getMemCacheFactory(),
+ new Util($c->getConfig(), $this->getRootFolder(), $this->getAppManager())
);
}
return new \OC_Defaults();
});
+ $this->registerService(SCSSCacher::class, function(Server $c) {
+ /** @var Factory $cacheFactory */
+ $cacheFactory = $c->query(Factory::class);
+ return new SCSSCacher(
+ $c->getLogger(),
+ $c->query(\OC\Files\AppData\Factory::class),
+ $c->getURLGenerator(),
+ $c->getConfig(),
+ $c->getThemingDefaults(),
+ \OC::$SERVERROOT,
+ $cacheFactory->createLocal('SCSS')
+ );
+ });
$this->registerService(EventDispatcher::class, function () {
return new EventDispatcher();
});
@@ -936,7 +983,13 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerService('LockdownManager', function (Server $c) {
- return new LockdownManager();
+ return new LockdownManager(function() use ($c) {
+ return $c->getSession();
+ });
+ });
+
+ $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
+ return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
});
$this->registerService(ICloudIdManager::class, function (Server $c) {
@@ -959,9 +1012,22 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
+ $this->registerService(Defaults::class, function (Server $c) {
+ return new Defaults(
+ $c->getThemingDefaults()
+ );
+ });
+ $this->registerAlias('Defaults', \OCP\Defaults::class);
+
$this->registerService(\OCP\ISession::class, function(SimpleContainer $c) {
return $c->query(\OCP\IUserSession::class)->getSession();
});
+
+ $this->registerService(IShareHelper::class, function(Server $c) {
+ return new ShareHelper(
+ $c->query(\OCP\Share\IManager::class)
+ );
+ });
}
/**
@@ -1576,7 +1642,7 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * @return \OC_Defaults
+ * @return \OCA\Theming\ThemingDefaults
*/
public function getThemingDefaults() {
return $this->query('ThemingDefaults');