@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | script('dav', [ |
| 25 | - 'settings-admin-caldav' |
|
| 25 | + 'settings-admin-caldav' |
|
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | 28 | /** @var \OCP\IL10N $l */ |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | - 'routes' => [ |
|
| 26 | - [ 'name' => 'AdminSettings#setSendInvitations', 'url' => '/setSendInvitation', 'verb' => 'POST' ], |
|
| 27 | - ] |
|
| 25 | + 'routes' => [ |
|
| 26 | + [ 'name' => 'AdminSettings#setSendInvitations', 'url' => '/setSendInvitation', 'verb' => 'POST' ], |
|
| 27 | + ] |
|
| 28 | 28 | ]; |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | 25 | 'routes' => [ |
| 26 | - [ 'name' => 'AdminSettings#setSendInvitations', 'url' => '/setSendInvitation', 'verb' => 'POST' ], |
|
| 26 | + ['name' => 'AdminSettings#setSendInvitations', 'url' => '/setSendInvitation', 'verb' => 'POST'], |
|
| 27 | 27 | ] |
| 28 | 28 | ]; |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | use OCA\DAV\Connector\Sabre\Principal; |
| 34 | 34 | |
| 35 | 35 | $authBackend = new Auth( |
| 36 | - \OC::$server->getSession(), |
|
| 37 | - \OC::$server->getUserSession(), |
|
| 38 | - \OC::$server->getRequest(), |
|
| 39 | - \OC::$server->getTwoFactorAuthManager(), |
|
| 40 | - \OC::$server->getBruteForceThrottler(), |
|
| 41 | - 'principals/' |
|
| 36 | + \OC::$server->getSession(), |
|
| 37 | + \OC::$server->getUserSession(), |
|
| 38 | + \OC::$server->getRequest(), |
|
| 39 | + \OC::$server->getTwoFactorAuthManager(), |
|
| 40 | + \OC::$server->getBruteForceThrottler(), |
|
| 41 | + 'principals/' |
|
| 42 | 42 | ); |
| 43 | 43 | $principalBackend = new Principal( |
| 44 | - \OC::$server->getUserManager(), |
|
| 45 | - \OC::$server->getGroupManager(), |
|
| 46 | - 'principals/' |
|
| 44 | + \OC::$server->getUserManager(), |
|
| 45 | + \OC::$server->getGroupManager(), |
|
| 46 | + 'principals/' |
|
| 47 | 47 | ); |
| 48 | 48 | $db = \OC::$server->getDatabaseConnection(); |
| 49 | 49 | $userManager = \OC::$server->getUserManager(); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $addressBookRoot->disableListing = !$debugging; // Disable listing |
| 63 | 63 | |
| 64 | 64 | $nodes = array( |
| 65 | - $principalCollection, |
|
| 66 | - $addressBookRoot, |
|
| 65 | + $principalCollection, |
|
| 66 | + $addressBookRoot, |
|
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | // Fire up server |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $server->addPlugin(new LegacyDAVACL()); |
| 81 | 81 | if ($debugging) { |
| 82 | - $server->addPlugin(new Sabre\DAV\Browser\Plugin()); |
|
| 82 | + $server->addPlugin(new Sabre\DAV\Browser\Plugin()); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
| 88 | 88 | |
| 89 | 89 | if ($sendInvitations) { |
| 90 | - $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); |
|
| 90 | + $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $server->addPlugin(new ExceptionLoggerPlugin('caldav', \OC::$server->getLogger())); |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
| 88 | 88 | |
| 89 | 89 | if ($sendInvitations) { |
| 90 | - $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); |
|
| 90 | + $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin(\OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $server->addPlugin(new ExceptionLoggerPlugin('caldav', \OC::$server->getLogger())); |
@@ -29,40 +29,40 @@ |
||
| 29 | 29 | |
| 30 | 30 | class CalDAVSettings implements ISettings { |
| 31 | 31 | |
| 32 | - /** @var IConfig */ |
|
| 33 | - private $config; |
|
| 32 | + /** @var IConfig */ |
|
| 33 | + private $config; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * CalDAVSettings constructor. |
|
| 37 | - * |
|
| 38 | - * @param IConfig $config |
|
| 39 | - */ |
|
| 40 | - public function __construct(IConfig $config) { |
|
| 41 | - $this->config = $config; |
|
| 42 | - } |
|
| 35 | + /** |
|
| 36 | + * CalDAVSettings constructor. |
|
| 37 | + * |
|
| 38 | + * @param IConfig $config |
|
| 39 | + */ |
|
| 40 | + public function __construct(IConfig $config) { |
|
| 41 | + $this->config = $config; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return TemplateResponse |
|
| 46 | - */ |
|
| 47 | - public function getForm() { |
|
| 48 | - $parameters = [ |
|
| 49 | - 'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'), |
|
| 50 | - ]; |
|
| 44 | + /** |
|
| 45 | + * @return TemplateResponse |
|
| 46 | + */ |
|
| 47 | + public function getForm() { |
|
| 48 | + $parameters = [ |
|
| 49 | + 'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'), |
|
| 50 | + ]; |
|
| 51 | 51 | |
| 52 | - return new TemplateResponse('dav', 'settings-admin-caldav', $parameters); |
|
| 53 | - } |
|
| 52 | + return new TemplateResponse('dav', 'settings-admin-caldav', $parameters); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @return string |
|
| 57 | - */ |
|
| 58 | - public function getSection() { |
|
| 59 | - return 'additional'; |
|
| 60 | - } |
|
| 55 | + /** |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 58 | + public function getSection() { |
|
| 59 | + return 'additional'; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return int |
|
| 64 | - */ |
|
| 65 | - public function getPriority() { |
|
| 66 | - return 20; |
|
| 67 | - } |
|
| 62 | + /** |
|
| 63 | + * @return int |
|
| 64 | + */ |
|
| 65 | + public function getPriority() { |
|
| 66 | + return 20; |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -60,205 +60,205 @@ |
||
| 60 | 60 | |
| 61 | 61 | class Server { |
| 62 | 62 | |
| 63 | - /** @var IRequest */ |
|
| 64 | - private $request; |
|
| 63 | + /** @var IRequest */ |
|
| 64 | + private $request; |
|
| 65 | 65 | |
| 66 | - /** @var string */ |
|
| 67 | - private $baseUri; |
|
| 66 | + /** @var string */ |
|
| 67 | + private $baseUri; |
|
| 68 | 68 | |
| 69 | - /** @var Connector\Sabre\Server */ |
|
| 70 | - private $server; |
|
| 69 | + /** @var Connector\Sabre\Server */ |
|
| 70 | + private $server; |
|
| 71 | 71 | |
| 72 | - public function __construct(IRequest $request, $baseUri) { |
|
| 73 | - $this->request = $request; |
|
| 74 | - $this->baseUri = $baseUri; |
|
| 75 | - $logger = \OC::$server->getLogger(); |
|
| 76 | - $mailer = \OC::$server->getMailer(); |
|
| 77 | - $dispatcher = \OC::$server->getEventDispatcher(); |
|
| 78 | - $timezone = new TimeFactory(); |
|
| 79 | - $sendInvitations = (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') ? true : false; |
|
| 72 | + public function __construct(IRequest $request, $baseUri) { |
|
| 73 | + $this->request = $request; |
|
| 74 | + $this->baseUri = $baseUri; |
|
| 75 | + $logger = \OC::$server->getLogger(); |
|
| 76 | + $mailer = \OC::$server->getMailer(); |
|
| 77 | + $dispatcher = \OC::$server->getEventDispatcher(); |
|
| 78 | + $timezone = new TimeFactory(); |
|
| 79 | + $sendInvitations = (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') ? true : false; |
|
| 80 | 80 | |
| 81 | - $root = new RootCollection(); |
|
| 82 | - $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
| 81 | + $root = new RootCollection(); |
|
| 82 | + $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
| 83 | 83 | |
| 84 | - // Add maintenance plugin |
|
| 85 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
| 84 | + // Add maintenance plugin |
|
| 85 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
| 86 | 86 | |
| 87 | - // Backends |
|
| 88 | - $authBackend = new Auth( |
|
| 89 | - \OC::$server->getSession(), |
|
| 90 | - \OC::$server->getUserSession(), |
|
| 91 | - \OC::$server->getRequest(), |
|
| 92 | - \OC::$server->getTwoFactorAuthManager(), |
|
| 93 | - \OC::$server->getBruteForceThrottler() |
|
| 94 | - ); |
|
| 87 | + // Backends |
|
| 88 | + $authBackend = new Auth( |
|
| 89 | + \OC::$server->getSession(), |
|
| 90 | + \OC::$server->getUserSession(), |
|
| 91 | + \OC::$server->getRequest(), |
|
| 92 | + \OC::$server->getTwoFactorAuthManager(), |
|
| 93 | + \OC::$server->getBruteForceThrottler() |
|
| 94 | + ); |
|
| 95 | 95 | |
| 96 | - // Set URL explicitly due to reverse-proxy situations |
|
| 97 | - $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
| 98 | - $this->server->setBaseUri($this->baseUri); |
|
| 96 | + // Set URL explicitly due to reverse-proxy situations |
|
| 97 | + $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
| 98 | + $this->server->setBaseUri($this->baseUri); |
|
| 99 | 99 | |
| 100 | - $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
| 101 | - $authPlugin = new Plugin(); |
|
| 102 | - $authPlugin->addBackend(new PublicAuth()); |
|
| 103 | - $this->server->addPlugin($authPlugin); |
|
| 100 | + $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
| 101 | + $authPlugin = new Plugin(); |
|
| 102 | + $authPlugin->addBackend(new PublicAuth()); |
|
| 103 | + $this->server->addPlugin($authPlugin); |
|
| 104 | 104 | |
| 105 | - // allow setup of additional auth backends |
|
| 106 | - $event = new SabrePluginEvent($this->server); |
|
| 107 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
| 105 | + // allow setup of additional auth backends |
|
| 106 | + $event = new SabrePluginEvent($this->server); |
|
| 107 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
| 108 | 108 | |
| 109 | - $bearerAuthBackend = new BearerAuth( |
|
| 110 | - \OC::$server->getUserSession(), |
|
| 111 | - \OC::$server->getSession(), |
|
| 112 | - \OC::$server->getRequest() |
|
| 113 | - ); |
|
| 114 | - $authPlugin->addBackend($bearerAuthBackend); |
|
| 115 | - // because we are throwing exceptions this plugin has to be the last one |
|
| 116 | - $authPlugin->addBackend($authBackend); |
|
| 109 | + $bearerAuthBackend = new BearerAuth( |
|
| 110 | + \OC::$server->getUserSession(), |
|
| 111 | + \OC::$server->getSession(), |
|
| 112 | + \OC::$server->getRequest() |
|
| 113 | + ); |
|
| 114 | + $authPlugin->addBackend($bearerAuthBackend); |
|
| 115 | + // because we are throwing exceptions this plugin has to be the last one |
|
| 116 | + $authPlugin->addBackend($authBackend); |
|
| 117 | 117 | |
| 118 | - // debugging |
|
| 119 | - if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
| 120 | - $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
| 121 | - } else { |
|
| 122 | - $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
| 123 | - } |
|
| 118 | + // debugging |
|
| 119 | + if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
| 120 | + $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
| 121 | + } else { |
|
| 122 | + $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
| 126 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
| 127 | - $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
| 125 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
| 126 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
| 127 | + $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
| 128 | 128 | |
| 129 | - // acl |
|
| 130 | - $acl = new DavAclPlugin(); |
|
| 131 | - $acl->principalCollectionSet = [ |
|
| 132 | - 'principals/users', 'principals/groups' |
|
| 133 | - ]; |
|
| 134 | - $acl->defaultUsernamePath = 'principals/users'; |
|
| 135 | - $this->server->addPlugin($acl); |
|
| 129 | + // acl |
|
| 130 | + $acl = new DavAclPlugin(); |
|
| 131 | + $acl->principalCollectionSet = [ |
|
| 132 | + 'principals/users', 'principals/groups' |
|
| 133 | + ]; |
|
| 134 | + $acl->defaultUsernamePath = 'principals/users'; |
|
| 135 | + $this->server->addPlugin($acl); |
|
| 136 | 136 | |
| 137 | - // calendar plugins |
|
| 138 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
| 139 | - $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
| 140 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
| 141 | - if ($sendInvitations) { |
|
| 142 | - $this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone)); |
|
| 143 | - } |
|
| 144 | - $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
| 145 | - $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
| 146 | - $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
| 147 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
| 148 | - \OC::$server->getConfig(), |
|
| 149 | - \OC::$server->getURLGenerator() |
|
| 150 | - )); |
|
| 137 | + // calendar plugins |
|
| 138 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
| 139 | + $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
| 140 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
| 141 | + if ($sendInvitations) { |
|
| 142 | + $this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone)); |
|
| 143 | + } |
|
| 144 | + $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
| 145 | + $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
| 146 | + $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
| 147 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
| 148 | + \OC::$server->getConfig(), |
|
| 149 | + \OC::$server->getURLGenerator() |
|
| 150 | + )); |
|
| 151 | 151 | |
| 152 | - // addressbook plugins |
|
| 153 | - $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
| 154 | - $this->server->addPlugin(new VCFExportPlugin()); |
|
| 155 | - $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
| 152 | + // addressbook plugins |
|
| 153 | + $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
| 154 | + $this->server->addPlugin(new VCFExportPlugin()); |
|
| 155 | + $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
| 156 | 156 | |
| 157 | - // system tags plugins |
|
| 158 | - $this->server->addPlugin(new SystemTagPlugin( |
|
| 159 | - \OC::$server->getSystemTagManager(), |
|
| 160 | - \OC::$server->getGroupManager(), |
|
| 161 | - \OC::$server->getUserSession() |
|
| 162 | - )); |
|
| 157 | + // system tags plugins |
|
| 158 | + $this->server->addPlugin(new SystemTagPlugin( |
|
| 159 | + \OC::$server->getSystemTagManager(), |
|
| 160 | + \OC::$server->getGroupManager(), |
|
| 161 | + \OC::$server->getUserSession() |
|
| 162 | + )); |
|
| 163 | 163 | |
| 164 | - // comments plugin |
|
| 165 | - $this->server->addPlugin(new CommentsPlugin( |
|
| 166 | - \OC::$server->getCommentsManager(), |
|
| 167 | - \OC::$server->getUserSession() |
|
| 168 | - )); |
|
| 164 | + // comments plugin |
|
| 165 | + $this->server->addPlugin(new CommentsPlugin( |
|
| 166 | + \OC::$server->getCommentsManager(), |
|
| 167 | + \OC::$server->getUserSession() |
|
| 168 | + )); |
|
| 169 | 169 | |
| 170 | - $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
| 170 | + $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
| 171 | 171 | |
| 172 | - // allow setup of additional plugins |
|
| 173 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
| 172 | + // allow setup of additional plugins |
|
| 173 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
| 174 | 174 | |
| 175 | - // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
| 176 | - // we do not provide locking we emulate it using a fake locking plugin. |
|
| 177 | - if($request->isUserAgent([ |
|
| 178 | - '/WebDAVFS/', |
|
| 179 | - '/Microsoft Office OneNote 2013/', |
|
| 180 | - '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
| 181 | - ])) { |
|
| 182 | - $this->server->addPlugin(new FakeLockerPlugin()); |
|
| 183 | - } |
|
| 175 | + // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
| 176 | + // we do not provide locking we emulate it using a fake locking plugin. |
|
| 177 | + if($request->isUserAgent([ |
|
| 178 | + '/WebDAVFS/', |
|
| 179 | + '/Microsoft Office OneNote 2013/', |
|
| 180 | + '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
| 181 | + ])) { |
|
| 182 | + $this->server->addPlugin(new FakeLockerPlugin()); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
| 186 | - $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
| 187 | - } |
|
| 185 | + if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
| 186 | + $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - // wait with registering these until auth is handled and the filesystem is setup |
|
| 190 | - $this->server->on('beforeMethod', function () { |
|
| 191 | - // custom properties plugin must be the last one |
|
| 192 | - $userSession = \OC::$server->getUserSession(); |
|
| 193 | - $user = $userSession->getUser(); |
|
| 194 | - if ($user !== null) { |
|
| 195 | - $view = \OC\Files\Filesystem::getView(); |
|
| 196 | - $this->server->addPlugin( |
|
| 197 | - new FilesPlugin( |
|
| 198 | - $this->server->tree, |
|
| 199 | - \OC::$server->getConfig(), |
|
| 200 | - $this->request, |
|
| 201 | - \OC::$server->getPreviewManager(), |
|
| 202 | - false, |
|
| 203 | - !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
| 204 | - ) |
|
| 205 | - ); |
|
| 189 | + // wait with registering these until auth is handled and the filesystem is setup |
|
| 190 | + $this->server->on('beforeMethod', function () { |
|
| 191 | + // custom properties plugin must be the last one |
|
| 192 | + $userSession = \OC::$server->getUserSession(); |
|
| 193 | + $user = $userSession->getUser(); |
|
| 194 | + if ($user !== null) { |
|
| 195 | + $view = \OC\Files\Filesystem::getView(); |
|
| 196 | + $this->server->addPlugin( |
|
| 197 | + new FilesPlugin( |
|
| 198 | + $this->server->tree, |
|
| 199 | + \OC::$server->getConfig(), |
|
| 200 | + $this->request, |
|
| 201 | + \OC::$server->getPreviewManager(), |
|
| 202 | + false, |
|
| 203 | + !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
| 204 | + ) |
|
| 205 | + ); |
|
| 206 | 206 | |
| 207 | - $this->server->addPlugin( |
|
| 208 | - new \Sabre\DAV\PropertyStorage\Plugin( |
|
| 209 | - new CustomPropertiesBackend( |
|
| 210 | - $this->server->tree, |
|
| 211 | - \OC::$server->getDatabaseConnection(), |
|
| 212 | - \OC::$server->getUserSession()->getUser() |
|
| 213 | - ) |
|
| 214 | - ) |
|
| 215 | - ); |
|
| 216 | - if ($view !== null) { |
|
| 217 | - $this->server->addPlugin( |
|
| 218 | - new QuotaPlugin($view, false)); |
|
| 219 | - } |
|
| 220 | - $this->server->addPlugin( |
|
| 221 | - new TagsPlugin( |
|
| 222 | - $this->server->tree, \OC::$server->getTagManager() |
|
| 223 | - ) |
|
| 224 | - ); |
|
| 225 | - // TODO: switch to LazyUserFolder |
|
| 226 | - $userFolder = \OC::$server->getUserFolder(); |
|
| 227 | - $this->server->addPlugin(new SharesPlugin( |
|
| 228 | - $this->server->tree, |
|
| 229 | - $userSession, |
|
| 230 | - $userFolder, |
|
| 231 | - \OC::$server->getShareManager() |
|
| 232 | - )); |
|
| 233 | - $this->server->addPlugin(new CommentPropertiesPlugin( |
|
| 234 | - \OC::$server->getCommentsManager(), |
|
| 235 | - $userSession |
|
| 236 | - )); |
|
| 237 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
| 238 | - if ($view !== null) { |
|
| 239 | - $this->server->addPlugin(new FilesReportPlugin( |
|
| 240 | - $this->server->tree, |
|
| 241 | - $view, |
|
| 242 | - \OC::$server->getSystemTagManager(), |
|
| 243 | - \OC::$server->getSystemTagObjectMapper(), |
|
| 244 | - \OC::$server->getTagManager(), |
|
| 245 | - $userSession, |
|
| 246 | - \OC::$server->getGroupManager(), |
|
| 247 | - $userFolder |
|
| 248 | - )); |
|
| 249 | - $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend( |
|
| 250 | - $this->server->tree, |
|
| 251 | - $user, |
|
| 252 | - \OC::$server->getRootFolder(), |
|
| 253 | - \OC::$server->getShareManager(), |
|
| 254 | - $view |
|
| 255 | - ))); |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - }); |
|
| 259 | - } |
|
| 207 | + $this->server->addPlugin( |
|
| 208 | + new \Sabre\DAV\PropertyStorage\Plugin( |
|
| 209 | + new CustomPropertiesBackend( |
|
| 210 | + $this->server->tree, |
|
| 211 | + \OC::$server->getDatabaseConnection(), |
|
| 212 | + \OC::$server->getUserSession()->getUser() |
|
| 213 | + ) |
|
| 214 | + ) |
|
| 215 | + ); |
|
| 216 | + if ($view !== null) { |
|
| 217 | + $this->server->addPlugin( |
|
| 218 | + new QuotaPlugin($view, false)); |
|
| 219 | + } |
|
| 220 | + $this->server->addPlugin( |
|
| 221 | + new TagsPlugin( |
|
| 222 | + $this->server->tree, \OC::$server->getTagManager() |
|
| 223 | + ) |
|
| 224 | + ); |
|
| 225 | + // TODO: switch to LazyUserFolder |
|
| 226 | + $userFolder = \OC::$server->getUserFolder(); |
|
| 227 | + $this->server->addPlugin(new SharesPlugin( |
|
| 228 | + $this->server->tree, |
|
| 229 | + $userSession, |
|
| 230 | + $userFolder, |
|
| 231 | + \OC::$server->getShareManager() |
|
| 232 | + )); |
|
| 233 | + $this->server->addPlugin(new CommentPropertiesPlugin( |
|
| 234 | + \OC::$server->getCommentsManager(), |
|
| 235 | + $userSession |
|
| 236 | + )); |
|
| 237 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
| 238 | + if ($view !== null) { |
|
| 239 | + $this->server->addPlugin(new FilesReportPlugin( |
|
| 240 | + $this->server->tree, |
|
| 241 | + $view, |
|
| 242 | + \OC::$server->getSystemTagManager(), |
|
| 243 | + \OC::$server->getSystemTagObjectMapper(), |
|
| 244 | + \OC::$server->getTagManager(), |
|
| 245 | + $userSession, |
|
| 246 | + \OC::$server->getGroupManager(), |
|
| 247 | + $userFolder |
|
| 248 | + )); |
|
| 249 | + $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend( |
|
| 250 | + $this->server->tree, |
|
| 251 | + $user, |
|
| 252 | + \OC::$server->getRootFolder(), |
|
| 253 | + \OC::$server->getShareManager(), |
|
| 254 | + $view |
|
| 255 | + ))); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + }); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - public function exec() { |
|
| 262 | - $this->server->exec(); |
|
| 263 | - } |
|
| 261 | + public function exec() { |
|
| 262 | + $this->server->exec(); |
|
| 263 | + } |
|
| 264 | 264 | } |
@@ -32,35 +32,35 @@ |
||
| 32 | 32 | |
| 33 | 33 | class AdminSettingsController extends Controller { |
| 34 | 34 | |
| 35 | - /** @var IConfig */ |
|
| 36 | - private $config; |
|
| 35 | + /** @var IConfig */ |
|
| 36 | + private $config; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * AdminSettingsController constructor. |
|
| 40 | - * |
|
| 41 | - * @param string $appName |
|
| 42 | - * @param IRequest $request |
|
| 43 | - * @param IConfig $config |
|
| 44 | - */ |
|
| 45 | - public function __construct($appName, |
|
| 46 | - IRequest $request, |
|
| 47 | - IConfig $config) { |
|
| 48 | - parent::__construct($appName, $request); |
|
| 38 | + /** |
|
| 39 | + * AdminSettingsController constructor. |
|
| 40 | + * |
|
| 41 | + * @param string $appName |
|
| 42 | + * @param IRequest $request |
|
| 43 | + * @param IConfig $config |
|
| 44 | + */ |
|
| 45 | + public function __construct($appName, |
|
| 46 | + IRequest $request, |
|
| 47 | + IConfig $config) { |
|
| 48 | + parent::__construct($appName, $request); |
|
| 49 | 49 | |
| 50 | - $this->config = $config; |
|
| 51 | - } |
|
| 50 | + $this->config = $config; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @param boolean $sendInvitations |
|
| 55 | - * @return JSONResponse |
|
| 56 | - */ |
|
| 57 | - public function setSendInvitations($sendInvitations) { |
|
| 58 | - if ($sendInvitations === null) { |
|
| 59 | - return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
| 60 | - } |
|
| 53 | + /** |
|
| 54 | + * @param boolean $sendInvitations |
|
| 55 | + * @return JSONResponse |
|
| 56 | + */ |
|
| 57 | + public function setSendInvitations($sendInvitations) { |
|
| 58 | + if ($sendInvitations === null) { |
|
| 59 | + return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $this->config->setAppValue('dav', 'sendInvitations', $sendInvitations ? 'yes' : 'no'); |
|
| 62 | + $this->config->setAppValue('dav', 'sendInvitations', $sendInvitations ? 'yes' : 'no'); |
|
| 63 | 63 | |
| 64 | - return new JSONResponse([]); |
|
| 65 | - } |
|
| 64 | + return new JSONResponse([]); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | * @param boolean $sendInvitations |
| 55 | 55 | * @return JSONResponse |
| 56 | 56 | */ |
| 57 | - public function setSendInvitations($sendInvitations) { |
|
| 57 | + public function setSendInvitations($sendInvitations) { |
|
| 58 | 58 | if ($sendInvitations === null) { |
| 59 | 59 | return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
| 60 | 60 | } |