Completed
Pull Request — master (#9773)
by Georg
16:52
created
apps/dav/lib/CalDAV/Plugin.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,27 +25,27 @@
 block discarded – undo
25 25
 
26 26
 class Plugin extends \Sabre\CalDAV\Plugin {
27 27
 
28
-	const SYSTEM_CALENDAR_ROOT = 'system-calendars';
28
+    const SYSTEM_CALENDAR_ROOT = 'system-calendars';
29 29
 
30
-	/**
31
-	 * @inheritdoc
32
-	 */
33
-	function getCalendarHomeForPrincipal($principalUrl):string {
30
+    /**
31
+     * @inheritdoc
32
+     */
33
+    function getCalendarHomeForPrincipal($principalUrl):string {
34 34
 
35
-		if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
36
-			list(, $principalId) = \Sabre\Uri\split($principalUrl);
37
-			return self::CALENDAR_ROOT . '/' . $principalId;
38
-		}
39
-		if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) {
40
-			list(, $principalId) = \Sabre\Uri\split($principalUrl);
41
-			return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId;
42
-		}
43
-		if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) {
44
-			list(, $principalId) = \Sabre\Uri\split($principalUrl);
45
-			return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
46
-		}
35
+        if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
36
+            list(, $principalId) = \Sabre\Uri\split($principalUrl);
37
+            return self::CALENDAR_ROOT . '/' . $principalId;
38
+        }
39
+        if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) {
40
+            list(, $principalId) = \Sabre\Uri\split($principalUrl);
41
+            return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId;
42
+        }
43
+        if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) {
44
+            list(, $principalId) = \Sabre\Uri\split($principalUrl);
45
+            return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
46
+        }
47 47
 
48
-		throw new \LogicException('This is not supposed to happen');
49
-	}
48
+        throw new \LogicException('This is not supposed to happen');
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
 
35 35
 		if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
36 36
 			list(, $principalId) = \Sabre\Uri\split($principalUrl);
37
-			return self::CALENDAR_ROOT . '/' . $principalId;
37
+			return self::CALENDAR_ROOT.'/'.$principalId;
38 38
 		}
39 39
 		if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) {
40 40
 			list(, $principalId) = \Sabre\Uri\split($principalUrl);
41
-			return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId;
41
+			return self::SYSTEM_CALENDAR_ROOT.'/calendar-resources/'.$principalId;
42 42
 		}
43 43
 		if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) {
44 44
 			list(, $principalId) = \Sabre\Uri\split($principalUrl);
45
-			return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
45
+			return self::SYSTEM_CALENDAR_ROOT.'/calendar-rooms/'.$principalId;
46 46
 		}
47 47
 
48 48
 		throw new \LogicException('This is not supposed to happen');
Please login to merge, or discard this patch.
apps/dav/lib/Migration/Version1005Date20180530124431.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -32,56 +32,56 @@
 block discarded – undo
32 32
  */
33 33
 class Version1005Date20180530124431 extends SimpleMigrationStep {
34 34
 
35
-	/**
36
-	 * @param IOutput $output
37
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
-	 * @param array $options
39
-	 * @return null|ISchemaWrapper
40
-	 * @since 13.0.0
41
-	 */
42
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
43
-		/** @var ISchemaWrapper $schema */
44
-		$schema = $schemaClosure();
35
+    /**
36
+     * @param IOutput $output
37
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
+     * @param array $options
39
+     * @return null|ISchemaWrapper
40
+     * @since 13.0.0
41
+     */
42
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
43
+        /** @var ISchemaWrapper $schema */
44
+        $schema = $schemaClosure();
45 45
 
46
-		$types = ['resources', 'rooms'];
47
-		foreach($types as $type) {
48
-			if (!$schema->hasTable('calendar_' . $type . '_cache')) {
49
-				$table = $schema->createTable('calendar_' . $type . '_cache');
46
+        $types = ['resources', 'rooms'];
47
+        foreach($types as $type) {
48
+            if (!$schema->hasTable('calendar_' . $type . '_cache')) {
49
+                $table = $schema->createTable('calendar_' . $type . '_cache');
50 50
 
51
-				$table->addColumn('id', Type::BIGINT, [
52
-					'autoincrement' => true,
53
-					'notnull' => true,
54
-					'length' => 11,
55
-					'unsigned' => true,
56
-				]);
57
-				$table->addColumn('backend_id', Type::STRING, [
58
-					'notnull' => false,
59
-					'length' => 64,
60
-				]);
61
-				$table->addColumn('resource_id', Type::STRING, [
62
-					'notnull' => false,
63
-					'length' => 64,
64
-				]);
65
-				$table->addColumn('email', Type::STRING, [
66
-					'notnull' => false,
67
-					'length' => 255,
68
-				]);
69
-				$table->addColumn('displayname', Type::STRING, [
70
-					'notnull' => false,
71
-					'length' => 255,
72
-				]);
73
-				$table->addColumn('group_restrictions', Type::STRING, [
74
-					'notnull' => false,
75
-					'length' => 4000,
76
-				]);
51
+                $table->addColumn('id', Type::BIGINT, [
52
+                    'autoincrement' => true,
53
+                    'notnull' => true,
54
+                    'length' => 11,
55
+                    'unsigned' => true,
56
+                ]);
57
+                $table->addColumn('backend_id', Type::STRING, [
58
+                    'notnull' => false,
59
+                    'length' => 64,
60
+                ]);
61
+                $table->addColumn('resource_id', Type::STRING, [
62
+                    'notnull' => false,
63
+                    'length' => 64,
64
+                ]);
65
+                $table->addColumn('email', Type::STRING, [
66
+                    'notnull' => false,
67
+                    'length' => 255,
68
+                ]);
69
+                $table->addColumn('displayname', Type::STRING, [
70
+                    'notnull' => false,
71
+                    'length' => 255,
72
+                ]);
73
+                $table->addColumn('group_restrictions', Type::STRING, [
74
+                    'notnull' => false,
75
+                    'length' => 4000,
76
+                ]);
77 77
 
78
-				$table->setPrimaryKey(['id'], 'calendar_' . $type . '_cache_id_idx');
79
-				$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_cache_backendresource_idx');
80
-				$table->addIndex(['email'], 'calendar_' . $type . '_cache_email_idx');
81
-				$table->addIndex(['displayname'], 'calendar_' . $type . '_cache_displayname_idx');
82
-			}
83
-		}
78
+                $table->setPrimaryKey(['id'], 'calendar_' . $type . '_cache_id_idx');
79
+                $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_cache_backendresource_idx');
80
+                $table->addIndex(['email'], 'calendar_' . $type . '_cache_email_idx');
81
+                $table->addIndex(['displayname'], 'calendar_' . $type . '_cache_displayname_idx');
82
+            }
83
+        }
84 84
 
85
-		return $schema;
86
-	}
85
+        return $schema;
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 		$schema = $schemaClosure();
45 45
 
46 46
 		$types = ['resources', 'rooms'];
47
-		foreach($types as $type) {
48
-			if (!$schema->hasTable('calendar_' . $type . '_cache')) {
49
-				$table = $schema->createTable('calendar_' . $type . '_cache');
47
+		foreach ($types as $type) {
48
+			if (!$schema->hasTable('calendar_'.$type.'_cache')) {
49
+				$table = $schema->createTable('calendar_'.$type.'_cache');
50 50
 
51 51
 				$table->addColumn('id', Type::BIGINT, [
52 52
 					'autoincrement' => true,
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 					'length' => 4000,
76 76
 				]);
77 77
 
78
-				$table->setPrimaryKey(['id'], 'calendar_' . $type . '_cache_id_idx');
79
-				$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_cache_backendresource_idx');
80
-				$table->addIndex(['email'], 'calendar_' . $type . '_cache_email_idx');
81
-				$table->addIndex(['displayname'], 'calendar_' . $type . '_cache_displayname_idx');
78
+				$table->setPrimaryKey(['id'], 'calendar_'.$type.'_cache_id_idx');
79
+				$table->addIndex(['backend_id', 'resource_id'], 'calendar_'.$type.'_cache_backendresource_idx');
80
+				$table->addIndex(['email'], 'calendar_'.$type.'_cache_email_idx');
81
+				$table->addIndex(['displayname'], 'calendar_'.$type.'_cache_displayname_idx');
82 82
 			}
83 83
 		}
84 84
 
Please login to merge, or discard this patch.
apps/dav/lib/Server.php 1 patch
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -65,237 +65,237 @@
 block discarded – undo
65 65
 
66 66
 class Server {
67 67
 
68
-	/** @var IRequest */
69
-	private $request;
68
+    /** @var IRequest */
69
+    private $request;
70 70
 
71
-	/** @var  string */
72
-	private $baseUri;
71
+    /** @var  string */
72
+    private $baseUri;
73 73
 
74
-	/** @var Connector\Sabre\Server  */
75
-	public $server;
74
+    /** @var Connector\Sabre\Server  */
75
+    public $server;
76 76
 
77
-	public function __construct(IRequest $request, $baseUri) {
78
-		$this->request = $request;
79
-		$this->baseUri = $baseUri;
80
-		$logger = \OC::$server->getLogger();
81
-		$dispatcher = \OC::$server->getEventDispatcher();
77
+    public function __construct(IRequest $request, $baseUri) {
78
+        $this->request = $request;
79
+        $this->baseUri = $baseUri;
80
+        $logger = \OC::$server->getLogger();
81
+        $dispatcher = \OC::$server->getEventDispatcher();
82 82
 
83
-		$root = new RootCollection();
84
-		$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
83
+        $root = new RootCollection();
84
+        $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
85 85
 
86
-		// Add maintenance plugin
87
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
86
+        // Add maintenance plugin
87
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
88 88
 
89
-		// Backends
90
-		$authBackend = new Auth(
91
-			\OC::$server->getSession(),
92
-			\OC::$server->getUserSession(),
93
-			\OC::$server->getRequest(),
94
-			\OC::$server->getTwoFactorAuthManager(),
95
-			\OC::$server->getBruteForceThrottler()
96
-		);
89
+        // Backends
90
+        $authBackend = new Auth(
91
+            \OC::$server->getSession(),
92
+            \OC::$server->getUserSession(),
93
+            \OC::$server->getRequest(),
94
+            \OC::$server->getTwoFactorAuthManager(),
95
+            \OC::$server->getBruteForceThrottler()
96
+        );
97 97
 
98
-		// Set URL explicitly due to reverse-proxy situations
99
-		$this->server->httpRequest->setUrl($this->request->getRequestUri());
100
-		$this->server->setBaseUri($this->baseUri);
98
+        // Set URL explicitly due to reverse-proxy situations
99
+        $this->server->httpRequest->setUrl($this->request->getRequestUri());
100
+        $this->server->setBaseUri($this->baseUri);
101 101
 
102
-		$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
103
-		$this->server->addPlugin(new AnonymousOptionsPlugin());
104
-		$authPlugin = new Plugin();
105
-		$authPlugin->addBackend(new PublicAuth());
106
-		$this->server->addPlugin($authPlugin);
102
+        $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
103
+        $this->server->addPlugin(new AnonymousOptionsPlugin());
104
+        $authPlugin = new Plugin();
105
+        $authPlugin->addBackend(new PublicAuth());
106
+        $this->server->addPlugin($authPlugin);
107 107
 
108
-		// allow setup of additional auth backends
109
-		$event = new SabrePluginEvent($this->server);
110
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
108
+        // allow setup of additional auth backends
109
+        $event = new SabrePluginEvent($this->server);
110
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
111 111
 
112
-		$bearerAuthBackend = new BearerAuth(
113
-			\OC::$server->getUserSession(),
114
-			\OC::$server->getSession(),
115
-			\OC::$server->getRequest()
116
-		);
117
-		$authPlugin->addBackend($bearerAuthBackend);
118
-		// because we are throwing exceptions this plugin has to be the last one
119
-		$authPlugin->addBackend($authBackend);
112
+        $bearerAuthBackend = new BearerAuth(
113
+            \OC::$server->getUserSession(),
114
+            \OC::$server->getSession(),
115
+            \OC::$server->getRequest()
116
+        );
117
+        $authPlugin->addBackend($bearerAuthBackend);
118
+        // because we are throwing exceptions this plugin has to be the last one
119
+        $authPlugin->addBackend($authBackend);
120 120
 
121
-		// debugging
122
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
123
-			$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
124
-		} else {
125
-			$this->server->addPlugin(new DummyGetResponsePlugin());
126
-		}
121
+        // debugging
122
+        if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
123
+            $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
124
+        } else {
125
+            $this->server->addPlugin(new DummyGetResponsePlugin());
126
+        }
127 127
 
128
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
129
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
130
-		$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
128
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
129
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
130
+        $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
131 131
 
132
-		// acl
133
-		$acl = new DavAclPlugin();
134
-		$acl->principalCollectionSet = [
135
-			'principals/users', 'principals/groups',
136
-			'principals/calendar-resources',
137
-			'principals/calendar-rooms',
138
-		];
139
-		$acl->defaultUsernamePath = 'principals/users';
140
-		$this->server->addPlugin($acl);
132
+        // acl
133
+        $acl = new DavAclPlugin();
134
+        $acl->principalCollectionSet = [
135
+            'principals/users', 'principals/groups',
136
+            'principals/calendar-resources',
137
+            'principals/calendar-rooms',
138
+        ];
139
+        $acl->defaultUsernamePath = 'principals/users';
140
+        $this->server->addPlugin($acl);
141 141
 
142
-		// calendar plugins
143
-		if ($this->requestIsForSubtree(['calendars', 'system-calendars', 'principals'])) {
144
-			$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
145
-			$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
146
-			$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
147
-			if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
148
-				$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
149
-			}
150
-			$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
151
-			$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
152
-			$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
153
-			$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
154
-				\OC::$server->getConfig(),
155
-				\OC::$server->getURLGenerator()
156
-			));
157
-		}
142
+        // calendar plugins
143
+        if ($this->requestIsForSubtree(['calendars', 'system-calendars', 'principals'])) {
144
+            $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
145
+            $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
146
+            $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
147
+            if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
148
+                $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
149
+            }
150
+            $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
151
+            $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
152
+            $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
153
+            $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
154
+                \OC::$server->getConfig(),
155
+                \OC::$server->getURLGenerator()
156
+            ));
157
+        }
158 158
 
159
-		// addressbook plugins
160
-		if ($this->requestIsForSubtree(['addressbooks', 'principals'])) {
161
-			$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
162
-			$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
163
-			$this->server->addPlugin(new VCFExportPlugin());
164
-			$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
165
-		}
159
+        // addressbook plugins
160
+        if ($this->requestIsForSubtree(['addressbooks', 'principals'])) {
161
+            $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
162
+            $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
163
+            $this->server->addPlugin(new VCFExportPlugin());
164
+            $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
165
+        }
166 166
 
167
-		// system tags plugins
168
-		$this->server->addPlugin(new SystemTagPlugin(
169
-			\OC::$server->getSystemTagManager(),
170
-			\OC::$server->getGroupManager(),
171
-			\OC::$server->getUserSession()
172
-		));
167
+        // system tags plugins
168
+        $this->server->addPlugin(new SystemTagPlugin(
169
+            \OC::$server->getSystemTagManager(),
170
+            \OC::$server->getGroupManager(),
171
+            \OC::$server->getUserSession()
172
+        ));
173 173
 
174
-		// comments plugin
175
-		$this->server->addPlugin(new CommentsPlugin(
176
-			\OC::$server->getCommentsManager(),
177
-			\OC::$server->getUserSession()
178
-		));
174
+        // comments plugin
175
+        $this->server->addPlugin(new CommentsPlugin(
176
+            \OC::$server->getCommentsManager(),
177
+            \OC::$server->getUserSession()
178
+        ));
179 179
 
180
-		$this->server->addPlugin(new CopyEtagHeaderPlugin());
181
-		$this->server->addPlugin(new ChunkingPlugin());
180
+        $this->server->addPlugin(new CopyEtagHeaderPlugin());
181
+        $this->server->addPlugin(new ChunkingPlugin());
182 182
 
183
-		// allow setup of additional plugins
184
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
183
+        // allow setup of additional plugins
184
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
185 185
 
186
-		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
187
-		// we do not provide locking we emulate it using a fake locking plugin.
188
-		if($request->isUserAgent([
189
-			'/WebDAVFS/',
190
-			'/OneNote/',
191
-			'/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
192
-		])) {
193
-			$this->server->addPlugin(new FakeLockerPlugin());
194
-		}
186
+        // Some WebDAV clients do require Class 2 WebDAV support (locking), since
187
+        // we do not provide locking we emulate it using a fake locking plugin.
188
+        if($request->isUserAgent([
189
+            '/WebDAVFS/',
190
+            '/OneNote/',
191
+            '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
192
+        ])) {
193
+            $this->server->addPlugin(new FakeLockerPlugin());
194
+        }
195 195
 
196
-		if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
197
-			$this->server->addPlugin(new BrowserErrorPagePlugin());
198
-		}
196
+        if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
197
+            $this->server->addPlugin(new BrowserErrorPagePlugin());
198
+        }
199 199
 
200
-		// wait with registering these until auth is handled and the filesystem is setup
201
-		$this->server->on('beforeMethod', function () use ($root) {
202
-			// custom properties plugin must be the last one
203
-			$userSession = \OC::$server->getUserSession();
204
-			$user = $userSession->getUser();
205
-			if ($user !== null) {
206
-				$view = \OC\Files\Filesystem::getView();
207
-				$this->server->addPlugin(
208
-					new FilesPlugin(
209
-						$this->server->tree,
210
-						\OC::$server->getConfig(),
211
-						$this->request,
212
-						\OC::$server->getPreviewManager(),
213
-						false,
214
-						!\OC::$server->getConfig()->getSystemValue('debug', false)
215
-					)
216
-				);
200
+        // wait with registering these until auth is handled and the filesystem is setup
201
+        $this->server->on('beforeMethod', function () use ($root) {
202
+            // custom properties plugin must be the last one
203
+            $userSession = \OC::$server->getUserSession();
204
+            $user = $userSession->getUser();
205
+            if ($user !== null) {
206
+                $view = \OC\Files\Filesystem::getView();
207
+                $this->server->addPlugin(
208
+                    new FilesPlugin(
209
+                        $this->server->tree,
210
+                        \OC::$server->getConfig(),
211
+                        $this->request,
212
+                        \OC::$server->getPreviewManager(),
213
+                        false,
214
+                        !\OC::$server->getConfig()->getSystemValue('debug', false)
215
+                    )
216
+                );
217 217
 
218
-				$this->server->addPlugin(
219
-					new \Sabre\DAV\PropertyStorage\Plugin(
220
-						new CustomPropertiesBackend(
221
-							$this->server->tree,
222
-							\OC::$server->getDatabaseConnection(),
223
-							\OC::$server->getUserSession()->getUser()
224
-						)
225
-					)
226
-				);
227
-				if ($view !== null) {
228
-					$this->server->addPlugin(
229
-						new QuotaPlugin($view, false));
230
-				}
231
-				$this->server->addPlugin(
232
-					new TagsPlugin(
233
-						$this->server->tree, \OC::$server->getTagManager()
234
-					)
235
-				);
236
-				// TODO: switch to LazyUserFolder
237
-				$userFolder = \OC::$server->getUserFolder();
238
-				$this->server->addPlugin(new SharesPlugin(
239
-					$this->server->tree,
240
-					$userSession,
241
-					$userFolder,
242
-					\OC::$server->getShareManager()
243
-				));
244
-				$this->server->addPlugin(new CommentPropertiesPlugin(
245
-					\OC::$server->getCommentsManager(),
246
-					$userSession
247
-				));
248
-				$this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
249
-				if ($view !== null) {
250
-					$this->server->addPlugin(new FilesReportPlugin(
251
-						$this->server->tree,
252
-						$view,
253
-						\OC::$server->getSystemTagManager(),
254
-						\OC::$server->getSystemTagObjectMapper(),
255
-						\OC::$server->getTagManager(),
256
-						$userSession,
257
-						\OC::$server->getGroupManager(),
258
-						$userFolder
259
-					));
260
-					$this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
261
-						$this->server->tree,
262
-						$user,
263
-						\OC::$server->getRootFolder(),
264
-						\OC::$server->getShareManager(),
265
-						$view
266
-					)));
267
-				}
268
-				$this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
269
-					\OC::$server->getConfig(),
270
-					\OC::$server->query(BirthdayService::class)
271
-				));
272
-			}
218
+                $this->server->addPlugin(
219
+                    new \Sabre\DAV\PropertyStorage\Plugin(
220
+                        new CustomPropertiesBackend(
221
+                            $this->server->tree,
222
+                            \OC::$server->getDatabaseConnection(),
223
+                            \OC::$server->getUserSession()->getUser()
224
+                        )
225
+                    )
226
+                );
227
+                if ($view !== null) {
228
+                    $this->server->addPlugin(
229
+                        new QuotaPlugin($view, false));
230
+                }
231
+                $this->server->addPlugin(
232
+                    new TagsPlugin(
233
+                        $this->server->tree, \OC::$server->getTagManager()
234
+                    )
235
+                );
236
+                // TODO: switch to LazyUserFolder
237
+                $userFolder = \OC::$server->getUserFolder();
238
+                $this->server->addPlugin(new SharesPlugin(
239
+                    $this->server->tree,
240
+                    $userSession,
241
+                    $userFolder,
242
+                    \OC::$server->getShareManager()
243
+                ));
244
+                $this->server->addPlugin(new CommentPropertiesPlugin(
245
+                    \OC::$server->getCommentsManager(),
246
+                    $userSession
247
+                ));
248
+                $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
249
+                if ($view !== null) {
250
+                    $this->server->addPlugin(new FilesReportPlugin(
251
+                        $this->server->tree,
252
+                        $view,
253
+                        \OC::$server->getSystemTagManager(),
254
+                        \OC::$server->getSystemTagObjectMapper(),
255
+                        \OC::$server->getTagManager(),
256
+                        $userSession,
257
+                        \OC::$server->getGroupManager(),
258
+                        $userFolder
259
+                    ));
260
+                    $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
261
+                        $this->server->tree,
262
+                        $user,
263
+                        \OC::$server->getRootFolder(),
264
+                        \OC::$server->getShareManager(),
265
+                        $view
266
+                    )));
267
+                }
268
+                $this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
269
+                    \OC::$server->getConfig(),
270
+                    \OC::$server->query(BirthdayService::class)
271
+                ));
272
+            }
273 273
 
274
-			// register plugins from apps
275
-			$pluginManager = new PluginManager(
276
-				\OC::$server,
277
-				\OC::$server->getAppManager()
278
-			);
279
-			foreach ($pluginManager->getAppPlugins() as $appPlugin) {
280
-				$this->server->addPlugin($appPlugin);
281
-			}
282
-			foreach ($pluginManager->getAppCollections() as $appCollection) {
283
-				$root->addChild($appCollection);
284
-			}
285
-		});
286
-	}
274
+            // register plugins from apps
275
+            $pluginManager = new PluginManager(
276
+                \OC::$server,
277
+                \OC::$server->getAppManager()
278
+            );
279
+            foreach ($pluginManager->getAppPlugins() as $appPlugin) {
280
+                $this->server->addPlugin($appPlugin);
281
+            }
282
+            foreach ($pluginManager->getAppCollections() as $appCollection) {
283
+                $root->addChild($appCollection);
284
+            }
285
+        });
286
+    }
287 287
 
288
-	public function exec() {
289
-		$this->server->exec();
290
-	}
288
+    public function exec() {
289
+        $this->server->exec();
290
+    }
291 291
 
292
-	private function requestIsForSubtree(array $subTrees): bool {
293
-		foreach ($subTrees as $subTree) {
294
-			$subTree = trim($subTree, ' /');
295
-			if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) {
296
-				return true;
297
-			}
298
-		}
299
-		return false;
300
-	}
292
+    private function requestIsForSubtree(array $subTrees): bool {
293
+        foreach ($subTrees as $subTree) {
294
+            $subTree = trim($subTree, ' /');
295
+            if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) {
296
+                return true;
297
+            }
298
+        }
299
+        return false;
300
+    }
301 301
 }
Please login to merge, or discard this patch.
lib/public/Calendar/Room/IBackend.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@
 block discarded – undo
31 31
  */
32 32
 interface IBackend {
33 33
 
34
-	/**
35
-	 * get a list of all rooms in this backend
36
-	 *
37
-	 * @return IRoom[]
38
-	 */
39
-	public function getAllRooms();
34
+    /**
35
+     * get a list of all rooms in this backend
36
+     *
37
+     * @return IRoom[]
38
+     */
39
+    public function getAllRooms();
40 40
 
41
-	/**
42
-	 * get a list of all room identifiers in this backend
43
-	 *
44
-	 * @return string[]
45
-	 */
46
-	public function listAllRooms();
41
+    /**
42
+     * get a list of all room identifiers in this backend
43
+     *
44
+     * @return string[]
45
+     */
46
+    public function listAllRooms();
47 47
 
48
-	/**
49
-	 * get a room by it's id
50
-	 *
51
-	 * @param string $id
52
-	 * @return IRoom|null
53
-	 */
54
-	public function getRoom($id);
48
+    /**
49
+     * get a room by it's id
50
+     *
51
+     * @param string $id
52
+     * @return IRoom|null
53
+     */
54
+    public function getRoom($id);
55 55
 }
Please login to merge, or discard this patch.
lib/public/Calendar/Room/IRoom.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -31,40 +31,40 @@
 block discarded – undo
31 31
  */
32 32
 interface IRoom {
33 33
 
34
-	/**
35
-	 * get the room id
36
-	 *
37
-	 * This id has to be unique within the backend
38
-	 *
39
-	 * @return string
40
-	 * @since 14.0.0
41
-	 */
42
-	public function getId();
34
+    /**
35
+     * get the room id
36
+     *
37
+     * This id has to be unique within the backend
38
+     *
39
+     * @return string
40
+     * @since 14.0.0
41
+     */
42
+    public function getId();
43 43
 
44
-	/**
45
-	 * get the display name for a room
46
-	 *
47
-	 * @return string
48
-	 * @since 14.0.0
49
-	 */
50
-	public function getDisplayName();
44
+    /**
45
+     * get the display name for a room
46
+     *
47
+     * @return string
48
+     * @since 14.0.0
49
+     */
50
+    public function getDisplayName();
51 51
 
52
-	/**
53
-	 * Get a list of groupIds that are allowed to access this room
54
-	 *
55
-	 * If an empty array is returned, no group restrictions are
56
-	 * applied.
57
-	 *
58
-	 * @return string[]
59
-	 * @since 14.0.0
60
-	 */
61
-	public function getGroupRestrictions();
52
+    /**
53
+     * Get a list of groupIds that are allowed to access this room
54
+     *
55
+     * If an empty array is returned, no group restrictions are
56
+     * applied.
57
+     *
58
+     * @return string[]
59
+     * @since 14.0.0
60
+     */
61
+    public function getGroupRestrictions();
62 62
 
63
-	/**
64
-	 * Get the name of the backend class the room is connected with
65
-	 *
66
-	 * @return string
67
-	 * @since 14.0.0
68
-	 */
69
-	public function getBackendClassName();
63
+    /**
64
+     * Get the name of the backend class the room is connected with
65
+     *
66
+     * @return string
67
+     * @since 14.0.0
68
+     */
69
+    public function getBackendClassName();
70 70
 }
Please login to merge, or discard this patch.
lib/public/Calendar/Resource/IBackend.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@
 block discarded – undo
31 31
  */
32 32
 interface IBackend {
33 33
 
34
-	/**
35
-	 * get a list of all resources in this backend
36
-	 *
37
-	 * @return IResource[]
38
-	 */
39
-	public function getAllResources();
34
+    /**
35
+     * get a list of all resources in this backend
36
+     *
37
+     * @return IResource[]
38
+     */
39
+    public function getAllResources();
40 40
 
41
-	/**
42
-	 * get a list of all resource identifiers in this backend
43
-	 *
44
-	 * @return string[]
45
-	 */
46
-	public function listAllResources();
41
+    /**
42
+     * get a list of all resource identifiers in this backend
43
+     *
44
+     * @return string[]
45
+     */
46
+    public function listAllResources();
47 47
 
48
-	/**
49
-	 * get a resource by it's id
50
-	 *
51
-	 * @param string $id
52
-	 * @return IResource|null
53
-	 */
54
-	public function getResource($id);
48
+    /**
49
+     * get a resource by it's id
50
+     *
51
+     * @param string $id
52
+     * @return IResource|null
53
+     */
54
+    public function getResource($id);
55 55
 }
Please login to merge, or discard this patch.
lib/public/Calendar/Resource/IResource.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -31,40 +31,40 @@
 block discarded – undo
31 31
  */
32 32
 interface IResource {
33 33
 
34
-	/**
35
-	 * get the resource id
36
-	 *
37
-	 * This id has to be unique within the backend
38
-	 *
39
-	 * @return string
40
-	 * @since 14.0.0
41
-	 */
42
-	public function getId();
34
+    /**
35
+     * get the resource id
36
+     *
37
+     * This id has to be unique within the backend
38
+     *
39
+     * @return string
40
+     * @since 14.0.0
41
+     */
42
+    public function getId();
43 43
 
44
-	/**
45
-	 * get the display name for a resource
46
-	 *
47
-	 * @return string
48
-	 * @since 14.0.0
49
-	 */
50
-	public function getDisplayName();
44
+    /**
45
+     * get the display name for a resource
46
+     *
47
+     * @return string
48
+     * @since 14.0.0
49
+     */
50
+    public function getDisplayName();
51 51
 
52
-	/**
53
-	 * Get a list of groupIds that are allowed to access this resource
54
-	 *
55
-	 * If an empty array is returned, no group restrictions are
56
-	 * applied.
57
-	 *
58
-	 * @return string[]
59
-	 * @since 14.0.0
60
-	 */
61
-	public function getGroupRestrictions();
52
+    /**
53
+     * Get a list of groupIds that are allowed to access this resource
54
+     *
55
+     * If an empty array is returned, no group restrictions are
56
+     * applied.
57
+     *
58
+     * @return string[]
59
+     * @since 14.0.0
60
+     */
61
+    public function getGroupRestrictions();
62 62
 
63
-	/**
64
-	 * Get the name of the backend class the room is connected with
65
-	 *
66
-	 * @return string
67
-	 * @since 14.0.0
68
-	 */
69
-	public function getBackendClassName();
63
+    /**
64
+     * Get the name of the backend class the room is connected with
65
+     *
66
+     * @return string
67
+     * @since 14.0.0
68
+     */
69
+    public function getBackendClassName();
70 70
 }
Please login to merge, or discard this patch.