Merge pull request #23745 from nextcloud/backport/23723/stable20

[stable20] Also run the SabreAuthInitEvent for the main server
This commit is contained in:
Morris Jobke 2020-10-28 13:13:18 +01:00 committed by GitHub
commit 3869c235de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -60,11 +60,13 @@ use OCA\DAV\Connector\Sabre\SharesPlugin;
use OCA\DAV\Connector\Sabre\TagsPlugin; use OCA\DAV\Connector\Sabre\TagsPlugin;
use OCA\DAV\DAV\CustomPropertiesBackend; use OCA\DAV\DAV\CustomPropertiesBackend;
use OCA\DAV\DAV\PublicAuth; use OCA\DAV\DAV\PublicAuth;
use OCA\DAV\Events\SabrePluginAuthInitEvent;
use OCA\DAV\Files\BrowserErrorPagePlugin; use OCA\DAV\Files\BrowserErrorPagePlugin;
use OCA\DAV\Files\LazySearchBackend; use OCA\DAV\Files\LazySearchBackend;
use OCA\DAV\Provisioning\Apple\AppleProvisioningPlugin; use OCA\DAV\Provisioning\Apple\AppleProvisioningPlugin;
use OCA\DAV\SystemTag\SystemTagPlugin; use OCA\DAV\SystemTag\SystemTagPlugin;
use OCA\DAV\Upload\ChunkingPlugin; use OCA\DAV\Upload\ChunkingPlugin;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest; use OCP\IRequest;
use OCP\SabrePluginEvent; use OCP\SabrePluginEvent;
use Sabre\CardDAV\VCFExportPlugin; use Sabre\CardDAV\VCFExportPlugin;
@ -88,6 +90,8 @@ class Server {
$this->baseUri = $baseUri; $this->baseUri = $baseUri;
$logger = \OC::$server->getLogger(); $logger = \OC::$server->getLogger();
$dispatcher = \OC::$server->getEventDispatcher(); $dispatcher = \OC::$server->getEventDispatcher();
/** @var IEventDispatcher $newDispatcher */
$newDispatcher = \OC::$server->query(IEventDispatcher::class);
$root = new RootCollection(); $root = new RootCollection();
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
@ -118,6 +122,9 @@ class Server {
$event = new SabrePluginEvent($this->server); $event = new SabrePluginEvent($this->server);
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
$event = new SabrePluginAuthInitEvent($this->server);
$newDispatcher->dispatchTyped($event);
$bearerAuthBackend = new BearerAuth( $bearerAuthBackend = new BearerAuth(
\OC::$server->getUserSession(), \OC::$server->getUserSession(),
\OC::$server->getSession(), \OC::$server->getSession(),