123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181 |
- <?php
- /**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @author Bernhard Reiter <ockham@raz.or.at>
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Björn Schießle <bjoern@schiessle.org>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Damjan Georgievski <gdamjan@gmail.com>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Julius Haertl <jus@bitgrid.net>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @author Michael Weimann <mail@michael-weimann.eu>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Piotr Mrówczyński <mrow4a@yahoo.com>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Robin McCorkell <robin@mccorkell.me.uk>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author root <root@localhost.localdomain>
- * @author Sander <brantje@gmail.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- * @author Tobia De Koninck <tobia@ledfan.be>
- * @author Vincent Petry <pvince81@owncloud.com>
- * @author Xheni Myrtaj <myrtajxheni@gmail.com>
- *
- * @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 <http://www.gnu.org/licenses/>
- *
- */
- namespace OC;
- use bantu\IniGetWrapper\IniGetWrapper;
- use OC\Accounts\AccountManager;
- use OC\App\AppManager;
- use OC\App\AppStore\Bundles\BundleFetcher;
- use OC\App\AppStore\Fetcher\AppFetcher;
- use OC\App\AppStore\Fetcher\CategoryFetcher;
- use OC\AppFramework\Http\Request;
- use OC\AppFramework\Utility\SimpleContainer;
- use OC\AppFramework\Utility\TimeFactory;
- use OC\Authentication\LoginCredentials\Store;
- use OC\Authentication\Token\IProvider;
- use OC\Avatar\AvatarManager;
- use OC\Collaboration\Collaborators\GroupPlugin;
- use OC\Collaboration\Collaborators\MailPlugin;
- use OC\Collaboration\Collaborators\RemoteGroupPlugin;
- use OC\Collaboration\Collaborators\RemotePlugin;
- use OC\Collaboration\Collaborators\UserPlugin;
- use OC\Command\CronBus;
- use OC\Comments\ManagerFactory as CommentsManagerFactory;
- use OC\Contacts\ContactsMenu\ActionFactory;
- use OC\Contacts\ContactsMenu\ContactsStore;
- use OC\Dashboard\DashboardManager;
- use OC\Diagnostics\EventLogger;
- use OC\Diagnostics\QueryLogger;
- use OC\Federation\CloudFederationFactory;
- use OC\Federation\CloudFederationProviderManager;
- use OC\Federation\CloudIdManager;
- use OC\Files\Config\UserMountCache;
- use OC\Files\Config\UserMountCacheListener;
- use OC\Files\Mount\CacheMountProvider;
- use OC\Files\Mount\LocalHomeMountProvider;
- use OC\Files\Mount\ObjectHomeMountProvider;
- use OC\Files\Node\HookConnector;
- use OC\Files\Node\LazyRoot;
- use OC\Files\Node\Root;
- use OC\Files\Storage\StorageFactory;
- use OC\Files\View;
- use OC\FullTextSearch\FullTextSearchManager;
- use OC\Http\Client\ClientService;
- use OC\IntegrityCheck\Checker;
- use OC\IntegrityCheck\Helpers\AppLocator;
- use OC\IntegrityCheck\Helpers\EnvironmentHelper;
- use OC\IntegrityCheck\Helpers\FileAccessHelper;
- use OC\Lock\DBLockingProvider;
- use OC\Lock\MemcacheLockingProvider;
- use OC\Lock\NoopLockingProvider;
- use OC\Lockdown\LockdownManager;
- use OC\Log\LogFactory;
- use OC\Mail\Mailer;
- use OC\Memcache\ArrayCache;
- use OC\Memcache\Factory;
- use OC\Notification\Manager;
- use OC\OCS\DiscoveryService;
- use OC\Preview\GeneratorHelper;
- use OC\Remote\Api\ApiFactory;
- use OC\Remote\InstanceFactory;
- use OC\RichObjectStrings\Validator;
- use OC\Security\Bruteforce\Throttler;
- use OC\Security\CertificateManager;
- use OC\Security\CredentialsManager;
- use OC\Security\Crypto;
- use OC\Security\CSP\ContentSecurityPolicyNonceManager;
- use OC\Security\CSRF\CsrfTokenGenerator;
- use OC\Security\CSRF\CsrfTokenManager;
- use OC\Security\CSRF\TokenStorage\SessionStorage;
- use OC\Security\Hasher;
- use OC\Security\SecureRandom;
- use OC\Security\TrustedDomainHelper;
- use OC\Session\CryptoWrapper;
- use OC\Share20\ProviderFactory;
- use OC\Share20\ShareHelper;
- use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
- use OC\Tagging\TagMapper;
- use OC\Template\IconsCacher;
- use OC\Template\JSCombiner;
- use OC\Template\SCSSCacher;
- use OCA\Theming\ImageManager;
- use OCA\Theming\ThemingDefaults;
- use OCA\Theming\Util;
- use OCP\Accounts\IAccountManager;
- use OCP\App\IAppManager;
- use OCP\Authentication\LoginCredentials\IStore;
- use OCP\Collaboration\AutoComplete\IManager;
- use OCP\Contacts\ContactsMenu\IActionFactory;
- use OCP\Contacts\ContactsMenu\IContactsStore;
- use OCP\Dashboard\IDashboardManager;
- use OCP\Defaults;
- use OCP\EventDispatcher\IEventDispatcher;
- use OCP\Federation\ICloudFederationFactory;
- use OCP\Federation\ICloudFederationProviderManager;
- use OCP\Federation\ICloudIdManager;
- use OCP\Files\NotFoundException;
- use OCP\Files\Storage\IStorageFactory;
- use OCP\FullTextSearch\IFullTextSearchManager;
- use OCP\GlobalScale\IConfig;
- use OCP\Group\Events\BeforeGroupCreatedEvent;
- use OCP\Group\Events\BeforeGroupDeletedEvent;
- use OCP\Group\Events\BeforeUserAddedEvent;
- use OCP\Group\Events\BeforeUserRemovedEvent;
- use OCP\Group\Events\GroupCreatedEvent;
- use OCP\Group\Events\GroupDeletedEvent;
- use OCP\Group\Events\UserAddedEvent;
- use OCP\Group\Events\UserRemovedEvent;
- use OCP\Group\ISubAdmin;
- use OCP\ICacheFactory;
- use OCP\IDBConnection;
- use OCP\IInitialStateService;
- use OCP\IL10N;
- use OCP\IServerContainer;
- use OCP\ITempManager;
- use OCP\IUser;
- use OCP\Lock\ILockingProvider;
- use OCP\Log\ILogFactory;
- use OCP\Remote\Api\IApiFactory;
- use OCP\Remote\IInstanceFactory;
- use OCP\RichObjectStrings\IValidator;
- use OCP\Security\IContentSecurityPolicyManager;
- use OCP\Share\IShareHelper;
- use OCP\User\Events\BeforePasswordUpdatedEvent;
- use OCP\User\Events\BeforeUserCreatedEvent;
- use OCP\User\Events\BeforeUserDeletedEvent;
- use OCP\User\Events\BeforeUserLoggedInEvent;
- use OCP\User\Events\BeforeUserLoggedInWithCookieEvent;
- use OCP\User\Events\BeforeUserLoggedOutEvent;
- use OCP\User\Events\PasswordUpdatedEvent;
- use OCP\User\Events\UserChangedEvent;
- use OCP\User\Events\UserCreatedEvent;
- use OCP\User\Events\UserDeletedEvent;
- use OCP\User\Events\UserLoggedInEvent;
- use OCP\User\Events\UserLoggedInWithCookieEvent;
- use OCP\User\Events\UserLoggedOutEvent;
- use Symfony\Component\EventDispatcher\EventDispatcherInterface;
- use Symfony\Component\EventDispatcher\GenericEvent;
- /**
- * Class Server
- *
- * @package OC
- *
- * TODO: hookup all manager classes
- */
- class Server extends ServerContainer implements IServerContainer {
- /** @var string */
- private $webRoot;
- /**
- * @param string $webRoot
- * @param \OC\Config $config
- */
- public function __construct($webRoot, \OC\Config $config) {
- parent::__construct();
- $this->webRoot = $webRoot;
- // To find out if we are running from CLI or not
- $this->registerParameter('isCLI', \OC::$CLI);
- $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
- return $c;
- });
- $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class);
- $this->registerAlias('CalendarManager', \OC\Calendar\Manager::class);
- $this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class);
- $this->registerAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class);
- $this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class);
- $this->registerAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class);
- $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
- $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
- $this->registerAlias(\OCP\DirectEditing\IManager::class, \OC\DirectEditing\Manager::class);
- $this->registerAlias(IActionFactory::class, ActionFactory::class);
- $this->registerService(\OCP\IPreview::class, function (Server $c) {
- return new PreviewManager(
- $c->getConfig(),
- $c->getRootFolder(),
- $c->getAppDataDir('preview'),
- $c->getEventDispatcher(),
- $c->getGeneratorHelper(),
- $c->getSession()->get('user_id')
- );
- });
- $this->registerAlias('PreviewManager', \OCP\IPreview::class);
- $this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
- return new \OC\Preview\Watcher(
- $c->getAppDataDir('preview')
- );
- });
- $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) {
- $view = new View();
- $util = new Encryption\Util(
- $view,
- $c->getUserManager(),
- $c->getGroupManager(),
- $c->getConfig()
- );
- return new Encryption\Manager(
- $c->getConfig(),
- $c->getLogger(),
- $c->getL10N('core'),
- new View(),
- $util,
- new ArrayCache()
- );
- });
- $this->registerAlias('EncryptionManager', \OCP\Encryption\IManager::class);
- $this->registerService('EncryptionFileHelper', function (Server $c) {
- $util = new Encryption\Util(
- new View(),
- $c->getUserManager(),
- $c->getGroupManager(),
- $c->getConfig()
- );
- return new Encryption\File(
- $util,
- $c->getRootFolder(),
- $c->getShareManager()
- );
- });
- $this->registerService('EncryptionKeyStorage', function (Server $c) {
- $view = new View();
- $util = new Encryption\Util(
- $view,
- $c->getUserManager(),
- $c->getGroupManager(),
- $c->getConfig()
- );
- return new Encryption\Keys\Storage($view, $util);
- });
- $this->registerService('TagMapper', function (Server $c) {
- return new TagMapper($c->getDatabaseConnection());
- });
- $this->registerService(\OCP\ITagManager::class, function (Server $c) {
- $tagMapper = $c->query('TagMapper');
- return new TagManager($tagMapper, $c->getUserSession());
- });
- $this->registerAlias('TagManager', \OCP\ITagManager::class);
- $this->registerService('SystemTagManagerFactory', function (Server $c) {
- $config = $c->getConfig();
- $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
- return new $factoryClass($this);
- });
- $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
- return $c->query('SystemTagManagerFactory')->getManager();
- });
- $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
- $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
- return $c->query('SystemTagManagerFactory')->getObjectMapper();
- });
- $this->registerService('RootFolder', function (Server $c) {
- $manager = \OC\Files\Filesystem::getMountManager(null);
- $view = new View();
- $root = new Root(
- $manager,
- $view,
- null,
- $c->getUserMountCache(),
- $this->getLogger(),
- $this->getUserManager()
- );
- $connector = new HookConnector($root, $view, $c->getEventDispatcher());
- $connector->viewToNode();
- $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
- $previewConnector->connectWatcher();
- return $root;
- });
- $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
- $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
- return new LazyRoot(function () use ($c) {
- return $c->query('RootFolder');
- });
- });
- $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
- $this->registerAlias('UserManager', \OC\User\Manager::class);
- $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
- $this->registerService(\OCP\IGroupManager::class, function (Server $c) {
- $groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger());
- $groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
- \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid));
- });
- $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $group->getGID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new GroupCreatedEvent($group));
- });
- $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group));
- });
- $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new GroupDeletedEvent($group));
- });
- $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user));
- });
- $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
- //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
- \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserAddedEvent($group, $user));
- });
- $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user));
- });
- $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user));
- });
- return $groupManager;
- });
- $this->registerAlias('GroupManager', \OCP\IGroupManager::class);
- $this->registerService(Store::class, function (Server $c) {
- $session = $c->getSession();
- if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
- $tokenProvider = $c->query(IProvider::class);
- } else {
- $tokenProvider = null;
- }
- $logger = $c->getLogger();
- return new Store($session, $logger, $tokenProvider);
- });
- $this->registerAlias(IStore::class, Store::class);
- $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
- $dbConnection = $c->getDatabaseConnection();
- return new Authentication\Token\DefaultTokenMapper($dbConnection);
- });
- $this->registerAlias(IProvider::class, Authentication\Token\Manager::class);
- $this->registerService(\OC\User\Session::class, function (Server $c) {
- $manager = $c->getUserManager();
- $session = new \OC\Session\Memory('');
- $timeFactory = new TimeFactory();
- // Token providers might require a working database. This code
- // might however be called when ownCloud is not yet setup.
- if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
- $defaultTokenProvider = $c->query(IProvider::class);
- } else {
- $defaultTokenProvider = null;
- }
- $legacyDispatcher = $c->getEventDispatcher();
- $userSession = new \OC\User\Session(
- $manager,
- $session,
- $timeFactory,
- $defaultTokenProvider,
- $c->getConfig(),
- $c->getSecureRandom(),
- $c->getLockdownManager(),
- $c->getLogger(),
- $c->query(IEventDispatcher::class)
- );
- $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password));
- });
- $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserCreatedEvent($user, $password));
- });
- $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
- $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user));
- });
- $userSession->listen('\OC\User', 'postDelete', function ($user) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserDeletedEvent($user));
- });
- $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword));
- });
- $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword));
- });
- $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password));
- });
- $userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin));
- });
- $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) {
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid));
- });
- $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password));
- });
- $userSession->listen('\OC\User', 'logout', function ($user) {
- \OC_Hook::emit('OC_User', 'logout', array());
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user));
- });
- $userSession->listen('\OC\User', 'postLogout', function ($user) {
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserLoggedOutEvent($user));
- });
- $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, 'old_value' => $oldValue));
- /** @var IEventDispatcher $dispatcher */
- $dispatcher = $this->query(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserChangedEvent($user, $feature, $value, $oldValue));
- });
- return $userSession;
- });
- $this->registerAlias(\OCP\IUserSession::class, \OC\User\Session::class);
- $this->registerAlias('UserSession', \OC\User\Session::class);
- $this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class);
- $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
- $this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
- $this->registerService(\OC\AllConfig::class, function (Server $c) {
- return new \OC\AllConfig(
- $c->getSystemConfig()
- );
- });
- $this->registerAlias('AllConfig', \OC\AllConfig::class);
- $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
- $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) {
- return new \OC\SystemConfig($config);
- });
- $this->registerAlias('SystemConfig', \OC\SystemConfig::class);
- $this->registerService(\OC\AppConfig::class, function (Server $c) {
- return new \OC\AppConfig($c->getDatabaseConnection());
- });
- $this->registerAlias('AppConfig', \OC\AppConfig::class);
- $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
- $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
- return new \OC\L10N\Factory(
- $c->getConfig(),
- $c->getRequest(),
- $c->getUserSession(),
- \OC::$SERVERROOT
- );
- });
- $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
- $this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
- $config = $c->getConfig();
- $cacheFactory = $c->getMemCacheFactory();
- $request = $c->getRequest();
- return new \OC\URLGenerator(
- $config,
- $cacheFactory,
- $request
- );
- });
- $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
- $this->registerAlias('AppFetcher', AppFetcher::class);
- $this->registerAlias('CategoryFetcher', CategoryFetcher::class);
- $this->registerService(\OCP\ICache::class, function ($c) {
- return new Cache\File();
- });
- $this->registerAlias('UserCache', \OCP\ICache::class);
- $this->registerService(Factory::class, function (Server $c) {
- $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
- ArrayCache::class,
- ArrayCache::class,
- ArrayCache::class
- );
- $config = $c->getConfig();
- if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
- $v = \OC_App::getAppVersions();
- $v['core'] = implode(',', \OC_Util::getVersion());
- $version = implode(',', $v);
- $instanceId = \OC_Util::getInstanceId();
- $path = \OC::$SERVERROOT;
- $prefix = md5($instanceId . '-' . $version . '-' . $path);
- return new \OC\Memcache\Factory($prefix, $c->getLogger(),
- $config->getSystemValue('memcache.local', null),
- $config->getSystemValue('memcache.distributed', null),
- $config->getSystemValue('memcache.locking', null)
- );
- }
- return $arrayCacheFactory;
- });
- $this->registerAlias('MemCacheFactory', Factory::class);
- $this->registerAlias(ICacheFactory::class, Factory::class);
- $this->registerService('RedisFactory', function (Server $c) {
- $systemConfig = $c->getSystemConfig();
- return new RedisFactory($systemConfig);
- });
- $this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
- return new \OC\Activity\Manager(
- $c->getRequest(),
- $c->getUserSession(),
- $c->getConfig(),
- $c->query(IValidator::class)
- );
- });
- $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
- $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
- return new \OC\Activity\EventMerger(
- $c->getL10N('lib')
- );
- });
- $this->registerAlias(IValidator::class, Validator::class);
- $this->registerService(AvatarManager::class, function(Server $c) {
- return new AvatarManager(
- $c->query(\OC\User\Manager::class),
- $c->getAppDataDir('avatar'),
- $c->getL10N('lib'),
- $c->getLogger(),
- $c->getConfig()
- );
- });
- $this->registerAlias(\OCP\IAvatarManager::class, AvatarManager::class);
- $this->registerAlias('AvatarManager', AvatarManager::class);
- $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
- $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class);
- $this->registerService(\OC\Log::class, function (Server $c) {
- $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
- $factory = new LogFactory($c, $this->getSystemConfig());
- $logger = $factory->get($logType);
- $registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
- return new Log($logger, $this->getSystemConfig(), null, $registry);
- });
- $this->registerAlias(\OCP\ILogger::class, \OC\Log::class);
- $this->registerAlias('Logger', \OC\Log::class);
- $this->registerService(ILogFactory::class, function (Server $c) {
- return new LogFactory($c, $this->getSystemConfig());
- });
- $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
- $config = $c->getConfig();
- return new \OC\BackgroundJob\JobList(
- $c->getDatabaseConnection(),
- $config,
- new TimeFactory()
- );
- });
- $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
- $this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
- $cacheFactory = $c->getMemCacheFactory();
- $logger = $c->getLogger();
- if ($cacheFactory->isLocalCacheAvailable()) {
- $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
- } else {
- $router = new \OC\Route\Router($logger);
- }
- return $router;
- });
- $this->registerAlias('Router', \OCP\Route\IRouter::class);
- $this->registerService(\OCP\ISearch::class, function ($c) {
- return new Search();
- });
- $this->registerAlias('Search', \OCP\ISearch::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();
- });
- $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
- $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
- return new Crypto($c->getConfig(), $c->getSecureRandom());
- });
- $this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
- $this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
- return new Hasher($c->getConfig());
- });
- $this->registerAlias('Hasher', \OCP\Security\IHasher::class);
- $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
- return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
- });
- $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
- $this->registerService(IDBConnection::class, function (Server $c) {
- $systemConfig = $c->getSystemConfig();
- $factory = new \OC\DB\ConnectionFactory($systemConfig);
- $type = $systemConfig->getValue('dbtype', 'sqlite');
- if (!$factory->isValidType($type)) {
- throw new \OC\DatabaseException('Invalid database type');
- }
- $connectionParams = $factory->createConnectionParams();
- $connection = $factory->getConnection($type, $connectionParams);
- $connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
- return $connection;
- });
- $this->registerAlias('DatabaseConnection', IDBConnection::class);
- $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
- $user = \OC_User::getUser();
- $uid = $user ? $user : null;
- return new ClientService(
- $c->getConfig(),
- new \OC\Security\CertificateManager(
- $uid,
- new View(),
- $c->getConfig(),
- $c->getLogger(),
- $c->getSecureRandom()
- )
- );
- });
- $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
- $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
- $eventLogger = new EventLogger();
- if ($c->getSystemConfig()->getValue('debug', false)) {
- // In debug mode, module is being activated by default
- $eventLogger->activate();
- }
- return $eventLogger;
- });
- $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
- $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
- $queryLogger = new QueryLogger();
- if ($c->getSystemConfig()->getValue('debug', false)) {
- // In debug mode, module is being activated by default
- $queryLogger->activate();
- }
- return $queryLogger;
- });
- $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
- $this->registerService(TempManager::class, function (Server $c) {
- return new TempManager(
- $c->getLogger(),
- $c->getConfig()
- );
- });
- $this->registerAlias('TempManager', TempManager::class);
- $this->registerAlias(ITempManager::class, TempManager::class);
- $this->registerService(AppManager::class, function (Server $c) {
- return new \OC\App\AppManager(
- $c->getUserSession(),
- $c->getConfig(),
- $c->query(\OC\AppConfig::class),
- $c->getGroupManager(),
- $c->getMemCacheFactory(),
- $c->getEventDispatcher(),
- $c->getLogger()
- );
- });
- $this->registerAlias('AppManager', AppManager::class);
- $this->registerAlias(IAppManager::class, AppManager::class);
- $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
- return new DateTimeZone(
- $c->getConfig(),
- $c->getSession()
- );
- });
- $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
- $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
- $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
- return new DateTimeFormatter(
- $c->getDateTimeZone()->getTimeZone(),
- $c->getL10N('lib', $language)
- );
- });
- $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
- $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
- $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
- $listener = new UserMountCacheListener($mountCache);
- $listener->listen($c->getUserManager());
- return $mountCache;
- });
- $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
- $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
- $loader = \OC\Files\Filesystem::getLoader();
- $mountCache = $c->query('UserMountCache');
- $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
- // builtin providers
- $config = $c->getConfig();
- $manager->registerProvider(new CacheMountProvider($config));
- $manager->registerHomeProvider(new LocalHomeMountProvider());
- $manager->registerHomeProvider(new ObjectHomeMountProvider($config));
- return $manager;
- });
- $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
- $this->registerService('IniWrapper', function ($c) {
- return new IniGetWrapper();
- });
- $this->registerService('AsyncCommandBus', function (Server $c) {
- $busClass = $c->getConfig()->getSystemValue('commandbus');
- if ($busClass) {
- list($app, $class) = explode('::', $busClass, 2);
- if ($c->getAppManager()->isInstalled($app)) {
- \OC_App::loadApp($app);
- return $c->query($class);
- } else {
- throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled");
- }
- } else {
- $jobList = $c->getJobList();
- return new CronBus($jobList);
- }
- });
- $this->registerService('TrustedDomainHelper', function ($c) {
- return new TrustedDomainHelper($this->getConfig());
- });
- $this->registerService(Throttler::class, function (Server $c) {
- return new Throttler(
- $c->getDatabaseConnection(),
- new TimeFactory(),
- $c->getLogger(),
- $c->getConfig()
- );
- });
- $this->registerAlias('Throttler', Throttler::class);
- $this->registerService('IntegrityCodeChecker', function (Server $c) {
- // IConfig and IAppManager requires a working database. This code
- // might however be called when ownCloud is not yet setup.
- if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
- $config = $c->getConfig();
- $appManager = $c->getAppManager();
- } else {
- $config = null;
- $appManager = null;
- }
- return new Checker(
- new EnvironmentHelper(),
- new FileAccessHelper(),
- new AppLocator(),
- $config,
- $c->getMemCacheFactory(),
- $appManager,
- $c->getTempManager(),
- $c->getMimeTypeDetector()
- );
- });
- $this->registerService(\OCP\IRequest::class, function ($c) {
- if (isset($this['urlParams'])) {
- $urlParams = $this['urlParams'];
- } else {
- $urlParams = [];
- }
- if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
- && in_array('fakeinput', stream_get_wrappers())
- ) {
- $stream = 'fakeinput://data';
- } else {
- $stream = 'php://input';
- }
- return new Request(
- [
- 'get' => $_GET,
- 'post' => $_POST,
- 'files' => $_FILES,
- 'server' => $_SERVER,
- 'env' => $_ENV,
- 'cookies' => $_COOKIE,
- 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
- ? $_SERVER['REQUEST_METHOD']
- : '',
- 'urlParams' => $urlParams,
- ],
- $this->getSecureRandom(),
- $this->getConfig(),
- $this->getCsrfTokenManager(),
- $stream
- );
- });
- $this->registerAlias('Request', \OCP\IRequest::class);
- $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
- return new Mailer(
- $c->getConfig(),
- $c->getLogger(),
- $c->query(Defaults::class),
- $c->getURLGenerator(),
- $c->getL10N('lib')
- );
- });
- $this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
- $this->registerService('LDAPProvider', function (Server $c) {
- $config = $c->getConfig();
- $factoryClass = $config->getSystemValue('ldapProviderFactory', null);
- if (is_null($factoryClass)) {
- throw new \Exception('ldapProviderFactory not set');
- }
- /** @var \OCP\LDAP\ILDAPProviderFactory $factory */
- $factory = new $factoryClass($this);
- return $factory->getLDAPProvider();
- });
- $this->registerService(ILockingProvider::class, function (Server $c) {
- $ini = $c->getIniWrapper();
- $config = $c->getConfig();
- $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
- if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
- /** @var \OC\Memcache\Factory $memcacheFactory */
- $memcacheFactory = $c->getMemCacheFactory();
- $memcache = $memcacheFactory->createLocking('lock');
- if (!($memcache instanceof \OC\Memcache\NullCache)) {
- return new MemcacheLockingProvider($memcache, $ttl);
- }
- return new DBLockingProvider(
- $c->getDatabaseConnection(),
- $c->getLogger(),
- new TimeFactory(),
- $ttl,
- !\OC::$CLI
- );
- }
- return new NoopLockingProvider();
- });
- $this->registerAlias('LockingProvider', ILockingProvider::class);
- $this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
- return new \OC\Files\Mount\Manager();
- });
- $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
- $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
- return new \OC\Files\Type\Detection(
- $c->getURLGenerator(),
- $c->getLogger(),
- \OC::$configDir,
- \OC::$SERVERROOT . '/resources/config/'
- );
- });
- $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
- $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
- return new \OC\Files\Type\Loader(
- $c->getDatabaseConnection()
- );
- });
- $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
- $this->registerService(BundleFetcher::class, function () {
- return new BundleFetcher($this->getL10N('lib'));
- });
- $this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
- return new Manager(
- $c->query(IValidator::class),
- $c->getLogger()
- );
- });
- $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
- $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
- $manager = new \OC\CapabilitiesManager($c->getLogger());
- $manager->registerCapability(function () use ($c) {
- return new \OC\OCS\CoreCapabilities($c->getConfig());
- });
- $manager->registerCapability(function () use ($c) {
- return $c->query(\OC\Security\Bruteforce\Capabilities::class);
- });
- return $manager;
- });
- $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
- $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
- $config = $c->getConfig();
- $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
- /** @var \OCP\Comments\ICommentsManagerFactory $factory */
- $factory = new $factoryClass($this);
- $manager = $factory->getManager();
- $manager->registerDisplayNameResolver('user', function($id) use ($c) {
- $manager = $c->getUserManager();
- $user = $manager->get($id);
- if(is_null($user)) {
- $l = $c->getL10N('core');
- $displayName = $l->t('Unknown user');
- } else {
- $displayName = $user->getDisplayName();
- }
- return $displayName;
- });
- return $manager;
- });
- $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
- $this->registerService('ThemingDefaults', function (Server $c) {
- /*
- * Dark magic for autoloader.
- * If we do a class_exists it will try to load the class which will
- * make composer cache the result. Resulting in errors when enabling
- * the theming app.
- */
- $prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
- if (isset($prefixes['OCA\\Theming\\'])) {
- $classExists = true;
- } else {
- $classExists = false;
- }
- if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
- return new ThemingDefaults(
- $c->getConfig(),
- $c->getL10N('theming'),
- $c->getURLGenerator(),
- $c->getMemCacheFactory(),
- new Util($c->getConfig(), $this->getAppManager(), $c->getAppDataDir('theming')),
- new ImageManager($c->getConfig(), $c->getAppDataDir('theming'), $c->getURLGenerator(), $this->getMemCacheFactory(), $this->getLogger()),
- $c->getAppManager(),
- $c->getNavigationManager()
- );
- }
- return new \OC_Defaults();
- });
- $this->registerService(SCSSCacher::class, function (Server $c) {
- return new SCSSCacher(
- $c->getLogger(),
- $c->query(\OC\Files\AppData\Factory::class),
- $c->getURLGenerator(),
- $c->getConfig(),
- $c->getThemingDefaults(),
- \OC::$SERVERROOT,
- $this->getMemCacheFactory(),
- $c->query(IconsCacher::class),
- new TimeFactory()
- );
- });
- $this->registerService(JSCombiner::class, function (Server $c) {
- return new JSCombiner(
- $c->getAppDataDir('js'),
- $c->getURLGenerator(),
- $this->getMemCacheFactory(),
- $c->getSystemConfig(),
- $c->getLogger()
- );
- });
- $this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class);
- $this->registerAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class);
- $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class);
- $this->registerService('CryptoWrapper', function (Server $c) {
- // FIXME: Instantiiated here due to cyclic dependency
- $request = new Request(
- [
- 'get' => $_GET,
- 'post' => $_POST,
- 'files' => $_FILES,
- 'server' => $_SERVER,
- 'env' => $_ENV,
- 'cookies' => $_COOKIE,
- 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
- ? $_SERVER['REQUEST_METHOD']
- : null,
- ],
- $c->getSecureRandom(),
- $c->getConfig()
- );
- return new CryptoWrapper(
- $c->getConfig(),
- $c->getCrypto(),
- $c->getSecureRandom(),
- $request
- );
- });
- $this->registerService(CsrfTokenManager::class, function (Server $c) {
- $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
- return new CsrfTokenManager(
- $tokenGenerator,
- $c->query(SessionStorage::class)
- );
- });
- $this->registerAlias('CsrfTokenManager', CsrfTokenManager::class);
- $this->registerService(SessionStorage::class, function (Server $c) {
- return new SessionStorage($c->getSession());
- });
- $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, \OC\Security\CSP\ContentSecurityPolicyManager::class);
- $this->registerAlias('ContentSecurityPolicyManager', \OC\Security\CSP\ContentSecurityPolicyManager::class);
- $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
- return new ContentSecurityPolicyNonceManager(
- $c->getCsrfTokenManager(),
- $c->getRequest()
- );
- });
- $this->registerService(\OCP\Share\IManager::class, function (Server $c) {
- $config = $c->getConfig();
- $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
- /** @var \OCP\Share\IProviderFactory $factory */
- $factory = new $factoryClass($this);
- $manager = new \OC\Share20\Manager(
- $c->getLogger(),
- $c->getConfig(),
- $c->getSecureRandom(),
- $c->getHasher(),
- $c->getMountManager(),
- $c->getGroupManager(),
- $c->getL10N('lib'),
- $c->getL10NFactory(),
- $factory,
- $c->getUserManager(),
- $c->getLazyRootFolder(),
- $c->getEventDispatcher(),
- $c->getMailer(),
- $c->getURLGenerator(),
- $c->getThemingDefaults(),
- $c->query(IEventDispatcher::class)
- );
- return $manager;
- });
- $this->registerAlias('ShareManager', \OCP\Share\IManager::class);
- $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
- $instance = new Collaboration\Collaborators\Search($c);
- // register default plugins
- $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
- $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
- $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
- $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
- $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]);
- return $instance;
- });
- $this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);
- $this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class);
- $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
- $this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, \OC\Collaboration\Resources\ProviderManager::class);
- $this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class);
- $this->registerService('SettingsManager', function (Server $c) {
- $manager = new \OC\Settings\Manager(
- $c->getLogger(),
- $c->getL10NFactory(),
- $c->getURLGenerator(),
- $c
- );
- return $manager;
- });
- $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
- return new \OC\Files\AppData\Factory(
- $c->getRootFolder(),
- $c->getSystemConfig()
- );
- });
- $this->registerService('LockdownManager', function (Server $c) {
- 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) {
- return new CloudIdManager();
- });
- $this->registerService(IConfig::class, function (Server $c) {
- return new GlobalScale\Config($c->getConfig());
- });
- $this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
- return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger());
- });
- $this->registerService(ICloudFederationFactory::class, function (Server $c) {
- return new CloudFederationFactory();
- });
- $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
- $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
- $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)
- );
- });
- $this->registerService(Installer::class, function(Server $c) {
- return new Installer(
- $c->getAppFetcher(),
- $c->getHTTPClientService(),
- $c->getTempManager(),
- $c->getLogger(),
- $c->getConfig()
- );
- });
- $this->registerService(IApiFactory::class, function(Server $c) {
- return new ApiFactory($c->getHTTPClientService());
- });
- $this->registerService(IInstanceFactory::class, function(Server $c) {
- $memcacheFactory = $c->getMemCacheFactory();
- return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
- });
- $this->registerService(IContactsStore::class, function(Server $c) {
- return new ContactsStore(
- $c->getContactsManager(),
- $c->getConfig(),
- $c->getUserManager(),
- $c->getGroupManager()
- );
- });
- $this->registerAlias(IContactsStore::class, ContactsStore::class);
- $this->registerAlias(IAccountManager::class, AccountManager::class);
- $this->registerService(IStorageFactory::class, function() {
- return new StorageFactory();
- });
- $this->registerAlias(IDashboardManager::class, DashboardManager::class);
- $this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class);
- $this->registerAlias(ISubAdmin::class, SubAdmin::class);
- $this->registerAlias(IInitialStateService::class, InitialStateService::class);
- $this->connectDispatcher();
- }
- /**
- * @return \OCP\Calendar\IManager
- */
- public function getCalendarManager() {
- return $this->query('CalendarManager');
- }
- /**
- * @return \OCP\Calendar\Resource\IManager
- */
- public function getCalendarResourceBackendManager() {
- return $this->query('CalendarResourceBackendManager');
- }
- /**
- * @return \OCP\Calendar\Room\IManager
- */
- public function getCalendarRoomBackendManager() {
- return $this->query('CalendarRoomBackendManager');
- }
- private function connectDispatcher() {
- $dispatcher = $this->getEventDispatcher();
- // Delete avatar on user deletion
- $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) {
- $logger = $this->getLogger();
- $manager = $this->getAvatarManager();
- /** @var IUser $user */
- $user = $e->getSubject();
- try {
- $avatar = $manager->getAvatar($user->getUID());
- $avatar->remove();
- } catch (NotFoundException $e) {
- // no avatar to remove
- } catch (\Exception $e) {
- // Ignore exceptions
- $logger->info('Could not cleanup avatar of ' . $user->getUID());
- }
- });
- $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
- $manager = $this->getAvatarManager();
- /** @var IUser $user */
- $user = $e->getSubject();
- $feature = $e->getArgument('feature');
- $oldValue = $e->getArgument('oldValue');
- $value = $e->getArgument('value');
- // We only change the avatar on display name changes
- if ($feature !== 'displayName') {
- return;
- }
- try {
- $avatar = $manager->getAvatar($user->getUID());
- $avatar->userChanged($feature, $oldValue, $value);
- } catch (NotFoundException $e) {
- // no avatar to remove
- }
- });
- }
- /**
- * @return \OCP\Contacts\IManager
- */
- public function getContactsManager() {
- return $this->query('ContactsManager');
- }
- /**
- * @return \OC\Encryption\Manager
- */
- public function getEncryptionManager() {
- return $this->query('EncryptionManager');
- }
- /**
- * @return \OC\Encryption\File
- */
- public function getEncryptionFilesHelper() {
- return $this->query('EncryptionFileHelper');
- }
- /**
- * @return \OCP\Encryption\Keys\IStorage
- */
- public function getEncryptionKeyStorage() {
- return $this->query('EncryptionKeyStorage');
- }
- /**
- * The current request object holding all information about the request
- * currently being processed is returned from this method.
- * In case the current execution was not initiated by a web request null is returned
- *
- * @return \OCP\IRequest
- */
- public function getRequest() {
- return $this->query('Request');
- }
- /**
- * Returns the preview manager which can create preview images for a given file
- *
- * @return \OCP\IPreview
- */
- public function getPreviewManager() {
- return $this->query('PreviewManager');
- }
- /**
- * Returns the tag manager which can get and set tags for different object types
- *
- * @see \OCP\ITagManager::load()
- * @return \OCP\ITagManager
- */
- public function getTagManager() {
- return $this->query('TagManager');
- }
- /**
- * Returns the system-tag manager
- *
- * @return \OCP\SystemTag\ISystemTagManager
- *
- * @since 9.0.0
- */
- public function getSystemTagManager() {
- return $this->query('SystemTagManager');
- }
- /**
- * Returns the system-tag object mapper
- *
- * @return \OCP\SystemTag\ISystemTagObjectMapper
- *
- * @since 9.0.0
- */
- public function getSystemTagObjectMapper() {
- return $this->query('SystemTagObjectMapper');
- }
- /**
- * Returns the avatar manager, used for avatar functionality
- *
- * @return \OCP\IAvatarManager
- */
- public function getAvatarManager() {
- return $this->query('AvatarManager');
- }
- /**
- * Returns the root folder of ownCloud's data directory
- *
- * @return \OCP\Files\IRootFolder
- */
- public function getRootFolder() {
- return $this->query('LazyRootFolder');
- }
- /**
- * Returns the root folder of ownCloud's data directory
- * This is the lazy variant so this gets only initialized once it
- * is actually used.
- *
- * @return \OCP\Files\IRootFolder
- */
- public function getLazyRootFolder() {
- return $this->query('LazyRootFolder');
- }
- /**
- * Returns a view to ownCloud's files folder
- *
- * @param string $userId user ID
- * @return \OCP\Files\Folder|null
- */
- public function getUserFolder($userId = null) {
- if ($userId === null) {
- $user = $this->getUserSession()->getUser();
- if (!$user) {
- return null;
- }
- $userId = $user->getUID();
- }
- $root = $this->getRootFolder();
- return $root->getUserFolder($userId);
- }
- /**
- * Returns an app-specific view in ownClouds data directory
- *
- * @return \OCP\Files\Folder
- * @deprecated since 9.2.0 use IAppData
- */
- public function getAppFolder() {
- $dir = '/' . \OC_App::getCurrentApp();
- $root = $this->getRootFolder();
- if (!$root->nodeExists($dir)) {
- $folder = $root->newFolder($dir);
- } else {
- $folder = $root->get($dir);
- }
- return $folder;
- }
- /**
- * @return \OC\User\Manager
- */
- public function getUserManager() {
- return $this->query('UserManager');
- }
- /**
- * @return \OC\Group\Manager
- */
- public function getGroupManager() {
- return $this->query('GroupManager');
- }
- /**
- * @return \OC\User\Session
- */
- public function getUserSession() {
- return $this->query('UserSession');
- }
- /**
- * @return \OCP\ISession
- */
- public function getSession() {
- return $this->query('UserSession')->getSession();
- }
- /**
- * @param \OCP\ISession $session
- */
- public function setSession(\OCP\ISession $session) {
- $this->query(SessionStorage::class)->setSession($session);
- $this->query('UserSession')->setSession($session);
- $this->query(Store::class)->setSession($session);
- }
- /**
- * @return \OC\Authentication\TwoFactorAuth\Manager
- */
- public function getTwoFactorAuthManager() {
- return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
- }
- /**
- * @return \OC\NavigationManager
- */
- public function getNavigationManager() {
- return $this->query('NavigationManager');
- }
- /**
- * @return \OCP\IConfig
- */
- public function getConfig() {
- return $this->query('AllConfig');
- }
- /**
- * @return \OC\SystemConfig
- */
- public function getSystemConfig() {
- return $this->query('SystemConfig');
- }
- /**
- * Returns the app config manager
- *
- * @return \OCP\IAppConfig
- */
- public function getAppConfig() {
- return $this->query('AppConfig');
- }
- /**
- * @return \OCP\L10N\IFactory
- */
- public function getL10NFactory() {
- return $this->query('L10NFactory');
- }
- /**
- * get an L10N instance
- *
- * @param string $app appid
- * @param string $lang
- * @return IL10N
- */
- public function getL10N($app, $lang = null) {
- return $this->getL10NFactory()->get($app, $lang);
- }
- /**
- * @return \OCP\IURLGenerator
- */
- public function getURLGenerator() {
- return $this->query('URLGenerator');
- }
- /**
- * @return AppFetcher
- */
- public function getAppFetcher() {
- return $this->query(AppFetcher::class);
- }
- /**
- * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
- * getMemCacheFactory() instead.
- *
- * @return \OCP\ICache
- * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
- */
- public function getCache() {
- return $this->query('UserCache');
- }
- /**
- * Returns an \OCP\CacheFactory instance
- *
- * @return \OCP\ICacheFactory
- */
- public function getMemCacheFactory() {
- return $this->query('MemCacheFactory');
- }
- /**
- * Returns an \OC\RedisFactory instance
- *
- * @return \OC\RedisFactory
- */
- public function getGetRedisFactory() {
- return $this->query('RedisFactory');
- }
- /**
- * Returns the current session
- *
- * @return \OCP\IDBConnection
- */
- public function getDatabaseConnection() {
- return $this->query('DatabaseConnection');
- }
- /**
- * Returns the activity manager
- *
- * @return \OCP\Activity\IManager
- */
- public function getActivityManager() {
- return $this->query('ActivityManager');
- }
- /**
- * Returns an job list for controlling background jobs
- *
- * @return \OCP\BackgroundJob\IJobList
- */
- public function getJobList() {
- return $this->query('JobList');
- }
- /**
- * Returns a logger instance
- *
- * @return \OCP\ILogger
- */
- public function getLogger() {
- return $this->query('Logger');
- }
- /**
- * @return ILogFactory
- * @throws \OCP\AppFramework\QueryException
- */
- public function getLogFactory() {
- return $this->query(ILogFactory::class);
- }
- /**
- * Returns a router for generating and matching urls
- *
- * @return \OCP\Route\IRouter
- */
- public function getRouter() {
- return $this->query('Router');
- }
- /**
- * Returns a search instance
- *
- * @return \OCP\ISearch
- */
- public function getSearch() {
- return $this->query('Search');
- }
- /**
- * Returns a SecureRandom instance
- *
- * @return \OCP\Security\ISecureRandom
- */
- public function getSecureRandom() {
- return $this->query('SecureRandom');
- }
- /**
- * Returns a Crypto instance
- *
- * @return \OCP\Security\ICrypto
- */
- public function getCrypto() {
- return $this->query('Crypto');
- }
- /**
- * Returns a Hasher instance
- *
- * @return \OCP\Security\IHasher
- */
- public function getHasher() {
- return $this->query('Hasher');
- }
- /**
- * Returns a CredentialsManager instance
- *
- * @return \OCP\Security\ICredentialsManager
- */
- public function getCredentialsManager() {
- return $this->query('CredentialsManager');
- }
- /**
- * Get the certificate manager for the user
- *
- * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
- * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
- */
- public function getCertificateManager($userId = '') {
- if ($userId === '') {
- $userSession = $this->getUserSession();
- $user = $userSession->getUser();
- if (is_null($user)) {
- return null;
- }
- $userId = $user->getUID();
- }
- return new CertificateManager(
- $userId,
- new View(),
- $this->getConfig(),
- $this->getLogger(),
- $this->getSecureRandom()
- );
- }
- /**
- * Returns an instance of the HTTP client service
- *
- * @return \OCP\Http\Client\IClientService
- */
- public function getHTTPClientService() {
- return $this->query('HttpClientService');
- }
- /**
- * Create a new event source
- *
- * @return \OCP\IEventSource
- */
- public function createEventSource() {
- return new \OC_EventSource();
- }
- /**
- * Get the active event logger
- *
- * The returned logger only logs data when debug mode is enabled
- *
- * @return \OCP\Diagnostics\IEventLogger
- */
- public function getEventLogger() {
- return $this->query('EventLogger');
- }
- /**
- * Get the active query logger
- *
- * The returned logger only logs data when debug mode is enabled
- *
- * @return \OCP\Diagnostics\IQueryLogger
- */
- public function getQueryLogger() {
- return $this->query('QueryLogger');
- }
- /**
- * Get the manager for temporary files and folders
- *
- * @return \OCP\ITempManager
- */
- public function getTempManager() {
- return $this->query('TempManager');
- }
- /**
- * Get the app manager
- *
- * @return \OCP\App\IAppManager
- */
- public function getAppManager() {
- return $this->query('AppManager');
- }
- /**
- * Creates a new mailer
- *
- * @return \OCP\Mail\IMailer
- */
- public function getMailer() {
- return $this->query('Mailer');
- }
- /**
- * Get the webroot
- *
- * @return string
- */
- public function getWebRoot() {
- return $this->webRoot;
- }
- /**
- * @return \OC\OCSClient
- */
- public function getOcsClient() {
- return $this->query('OcsClient');
- }
- /**
- * @return \OCP\IDateTimeZone
- */
- public function getDateTimeZone() {
- return $this->query('DateTimeZone');
- }
- /**
- * @return \OCP\IDateTimeFormatter
- */
- public function getDateTimeFormatter() {
- return $this->query('DateTimeFormatter');
- }
- /**
- * @return \OCP\Files\Config\IMountProviderCollection
- */
- public function getMountProviderCollection() {
- return $this->query('MountConfigManager');
- }
- /**
- * Get the IniWrapper
- *
- * @return IniGetWrapper
- */
- public function getIniWrapper() {
- return $this->query('IniWrapper');
- }
- /**
- * @return \OCP\Command\IBus
- */
- public function getCommandBus() {
- return $this->query('AsyncCommandBus');
- }
- /**
- * Get the trusted domain helper
- *
- * @return TrustedDomainHelper
- */
- public function getTrustedDomainHelper() {
- return $this->query('TrustedDomainHelper');
- }
- /**
- * Get the locking provider
- *
- * @return \OCP\Lock\ILockingProvider
- * @since 8.1.0
- */
- public function getLockingProvider() {
- return $this->query('LockingProvider');
- }
- /**
- * @return \OCP\Files\Mount\IMountManager
- **/
- function getMountManager() {
- return $this->query('MountManager');
- }
- /** @return \OCP\Files\Config\IUserMountCache */
- function getUserMountCache() {
- return $this->query('UserMountCache');
- }
- /**
- * Get the MimeTypeDetector
- *
- * @return \OCP\Files\IMimeTypeDetector
- */
- public function getMimeTypeDetector() {
- return $this->query('MimeTypeDetector');
- }
- /**
- * Get the MimeTypeLoader
- *
- * @return \OCP\Files\IMimeTypeLoader
- */
- public function getMimeTypeLoader() {
- return $this->query('MimeTypeLoader');
- }
- /**
- * Get the manager of all the capabilities
- *
- * @return \OC\CapabilitiesManager
- */
- public function getCapabilitiesManager() {
- return $this->query('CapabilitiesManager');
- }
- /**
- * Get the EventDispatcher
- *
- * @return EventDispatcherInterface
- * @since 8.2.0
- * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher
- */
- public function getEventDispatcher() {
- return $this->query(\OC\EventDispatcher\SymfonyAdapter::class);
- }
- /**
- * Get the Notification Manager
- *
- * @return \OCP\Notification\IManager
- * @since 8.2.0
- */
- public function getNotificationManager() {
- return $this->query('NotificationManager');
- }
- /**
- * @return \OCP\Comments\ICommentsManager
- */
- public function getCommentsManager() {
- return $this->query('CommentsManager');
- }
- /**
- * @return \OCA\Theming\ThemingDefaults
- */
- public function getThemingDefaults() {
- return $this->query('ThemingDefaults');
- }
- /**
- * @return \OC\IntegrityCheck\Checker
- */
- public function getIntegrityCodeChecker() {
- return $this->query('IntegrityCodeChecker');
- }
- /**
- * @return \OC\Session\CryptoWrapper
- */
- public function getSessionCryptoWrapper() {
- return $this->query('CryptoWrapper');
- }
- /**
- * @return CsrfTokenManager
- */
- public function getCsrfTokenManager() {
- return $this->query(CsrfTokenManager::class);
- }
- /**
- * @return Throttler
- */
- public function getBruteForceThrottler() {
- return $this->query('Throttler');
- }
- /**
- * @return IContentSecurityPolicyManager
- */
- public function getContentSecurityPolicyManager() {
- return $this->query('ContentSecurityPolicyManager');
- }
- /**
- * @return ContentSecurityPolicyNonceManager
- */
- public function getContentSecurityPolicyNonceManager() {
- return $this->query('ContentSecurityPolicyNonceManager');
- }
- /**
- * Not a public API as of 8.2, wait for 9.0
- *
- * @return \OCA\Files_External\Service\BackendService
- */
- public function getStoragesBackendService() {
- return $this->query('OCA\\Files_External\\Service\\BackendService');
- }
- /**
- * Not a public API as of 8.2, wait for 9.0
- *
- * @return \OCA\Files_External\Service\GlobalStoragesService
- */
- public function getGlobalStoragesService() {
- return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
- }
- /**
- * Not a public API as of 8.2, wait for 9.0
- *
- * @return \OCA\Files_External\Service\UserGlobalStoragesService
- */
- public function getUserGlobalStoragesService() {
- return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
- }
- /**
- * Not a public API as of 8.2, wait for 9.0
- *
- * @return \OCA\Files_External\Service\UserStoragesService
- */
- public function getUserStoragesService() {
- return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
- }
- /**
- * @return \OCP\Share\IManager
- */
- public function getShareManager() {
- return $this->query('ShareManager');
- }
- /**
- * @return \OCP\Collaboration\Collaborators\ISearch
- */
- public function getCollaboratorSearch() {
- return $this->query('CollaboratorSearch');
- }
- /**
- * @return \OCP\Collaboration\AutoComplete\IManager
- */
- public function getAutoCompleteManager(){
- return $this->query(IManager::class);
- }
- /**
- * Returns the LDAP Provider
- *
- * @return \OCP\LDAP\ILDAPProvider
- */
- public function getLDAPProvider() {
- return $this->query('LDAPProvider');
- }
- /**
- * @return \OCP\Settings\IManager
- */
- public function getSettingsManager() {
- return $this->query('SettingsManager');
- }
- /**
- * @return \OCP\Files\IAppData
- */
- public function getAppDataDir($app) {
- /** @var \OC\Files\AppData\Factory $factory */
- $factory = $this->query(\OC\Files\AppData\Factory::class);
- return $factory->get($app);
- }
- /**
- * @return \OCP\Lockdown\ILockdownManager
- */
- public function getLockdownManager() {
- return $this->query('LockdownManager');
- }
- /**
- * @return \OCP\Federation\ICloudIdManager
- */
- public function getCloudIdManager() {
- return $this->query(ICloudIdManager::class);
- }
- /**
- * @return \OCP\GlobalScale\IConfig
- */
- public function getGlobalScaleConfig() {
- return $this->query(IConfig::class);
- }
- /**
- * @return \OCP\Federation\ICloudFederationProviderManager
- */
- public function getCloudFederationProviderManager() {
- return $this->query(ICloudFederationProviderManager::class);
- }
- /**
- * @return \OCP\Remote\Api\IApiFactory
- */
- public function getRemoteApiFactory() {
- return $this->query(IApiFactory::class);
- }
- /**
- * @return \OCP\Federation\ICloudFederationFactory
- */
- public function getCloudFederationFactory() {
- return $this->query(ICloudFederationFactory::class);
- }
- /**
- * @return \OCP\Remote\IInstanceFactory
- */
- public function getRemoteInstanceFactory() {
- return $this->query(IInstanceFactory::class);
- }
- /**
- * @return IStorageFactory
- */
- public function getStorageFactory() {
- return $this->query(IStorageFactory::class);
- }
- /**
- * Get the Preview GeneratorHelper
- *
- * @return GeneratorHelper
- * @since 17.0.0
- */
- public function getGeneratorHelper() {
- return $this->query(\OC\Preview\GeneratorHelper::class);
- }
- }
|