Passed
Push — master ( 902adb...3cf321 )
by Christoph
10:44 queued 11s
created
apps/dav/lib/CardDAV/UserAddressBooks.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -40,84 +40,84 @@
 block discarded – undo
40 40
 
41 41
 class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
42 42
 
43
-	/** @var IL10N */
44
-	protected $l10n;
45
-
46
-	/** @var IConfig */
47
-	protected $config;
48
-
49
-	/** @var PluginManager */
50
-	private $pluginManager;
51
-
52
-	public function __construct(Backend\BackendInterface $carddavBackend,
53
-								string $principalUri,
54
-								PluginManager $pluginManager) {
55
-		parent::__construct($carddavBackend, $principalUri);
56
-		$this->pluginManager = $pluginManager;
57
-	}
58
-
59
-	/**
60
-	 * Returns a list of address books
61
-	 *
62
-	 * @return IAddressBook[]
63
-	 */
64
-	function getChildren() {
65
-		if ($this->l10n === null) {
66
-			$this->l10n = \OC::$server->getL10N('dav');
67
-		}
68
-		if ($this->config === null) {
69
-			$this->config = \OC::$server->getConfig();
70
-		}
71
-
72
-		$addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
73
-		/** @var IAddressBook[] $objects */
74
-		$objects = array_map(function(array $addressBook) {
75
-			if ($addressBook['principaluri'] === 'principals/system/system') {
76
-				return new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config);
77
-			}
78
-
79
-			return new AddressBook($this->carddavBackend, $addressBook, $this->l10n);
80
-		}, $addressBooks);
81
-		/** @var IAddressBook[][] $objectsFromPlugins */
82
-		$objectsFromPlugins = array_map(function(IAddressBookProvider $plugin): array {
83
-			return $plugin->fetchAllForAddressBookHome($this->principalUri);
84
-		}, $this->pluginManager->getAddressBookPlugins());
85
-
86
-		return array_merge($objects, ...$objectsFromPlugins);
87
-	}
88
-
89
-	public function createExtendedCollection($name, MkCol $mkCol) {
90
-		if (ExternalAddressBook::doesViolateReservedName($name)) {
91
-			throw new MethodNotAllowed('The resource you tried to create has a reserved name');
92
-		}
93
-
94
-		parent::createExtendedCollection($name, $mkCol);
95
-	}
96
-
97
-	/**
98
-	 * Returns a list of ACE's for this node.
99
-	 *
100
-	 * Each ACE has the following properties:
101
-	 *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
102
-	 *     currently the only supported privileges
103
-	 *   * 'principal', a url to the principal who owns the node
104
-	 *   * 'protected' (optional), indicating that this ACE is not allowed to
105
-	 *      be updated.
106
-	 *
107
-	 * @return array
108
-	 */
109
-	function getACL() {
110
-
111
-		$acl = parent::getACL();
112
-		if ($this->principalUri === 'principals/system/system') {
113
-			$acl[] = [
114
-				'privilege' => '{DAV:}read',
115
-				'principal' => '{DAV:}authenticated',
116
-				'protected' => true,
117
-			];
118
-		}
119
-
120
-		return $acl;
121
-	}
43
+    /** @var IL10N */
44
+    protected $l10n;
45
+
46
+    /** @var IConfig */
47
+    protected $config;
48
+
49
+    /** @var PluginManager */
50
+    private $pluginManager;
51
+
52
+    public function __construct(Backend\BackendInterface $carddavBackend,
53
+                                string $principalUri,
54
+                                PluginManager $pluginManager) {
55
+        parent::__construct($carddavBackend, $principalUri);
56
+        $this->pluginManager = $pluginManager;
57
+    }
58
+
59
+    /**
60
+     * Returns a list of address books
61
+     *
62
+     * @return IAddressBook[]
63
+     */
64
+    function getChildren() {
65
+        if ($this->l10n === null) {
66
+            $this->l10n = \OC::$server->getL10N('dav');
67
+        }
68
+        if ($this->config === null) {
69
+            $this->config = \OC::$server->getConfig();
70
+        }
71
+
72
+        $addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
73
+        /** @var IAddressBook[] $objects */
74
+        $objects = array_map(function(array $addressBook) {
75
+            if ($addressBook['principaluri'] === 'principals/system/system') {
76
+                return new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config);
77
+            }
78
+
79
+            return new AddressBook($this->carddavBackend, $addressBook, $this->l10n);
80
+        }, $addressBooks);
81
+        /** @var IAddressBook[][] $objectsFromPlugins */
82
+        $objectsFromPlugins = array_map(function(IAddressBookProvider $plugin): array {
83
+            return $plugin->fetchAllForAddressBookHome($this->principalUri);
84
+        }, $this->pluginManager->getAddressBookPlugins());
85
+
86
+        return array_merge($objects, ...$objectsFromPlugins);
87
+    }
88
+
89
+    public function createExtendedCollection($name, MkCol $mkCol) {
90
+        if (ExternalAddressBook::doesViolateReservedName($name)) {
91
+            throw new MethodNotAllowed('The resource you tried to create has a reserved name');
92
+        }
93
+
94
+        parent::createExtendedCollection($name, $mkCol);
95
+    }
96
+
97
+    /**
98
+     * Returns a list of ACE's for this node.
99
+     *
100
+     * Each ACE has the following properties:
101
+     *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
102
+     *     currently the only supported privileges
103
+     *   * 'principal', a url to the principal who owns the node
104
+     *   * 'protected' (optional), indicating that this ACE is not allowed to
105
+     *      be updated.
106
+     *
107
+     * @return array
108
+     */
109
+    function getACL() {
110
+
111
+        $acl = parent::getACL();
112
+        if ($this->principalUri === 'principals/system/system') {
113
+            $acl[] = [
114
+                'privilege' => '{DAV:}read',
115
+                'principal' => '{DAV:}authenticated',
116
+                'protected' => true,
117
+            ];
118
+        }
119
+
120
+        return $acl;
121
+    }
122 122
 
123 123
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/AppInfo/Application.php 1 patch
Indentation   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -65,242 +65,242 @@
 block discarded – undo
65 65
 
66 66
 class Application extends App {
67 67
 
68
-	const APP_ID = 'files_sharing';
69
-
70
-	public function __construct(array $urlParams = []) {
71
-		parent::__construct(self::APP_ID, $urlParams);
72
-
73
-		$container = $this->getContainer();
74
-
75
-		/** @var IServerContainer $server */
76
-		$server = $container->getServer();
77
-
78
-		/** @var IEventDispatcher $dispatcher */
79
-		$dispatcher = $container->query(IEventDispatcher::class);
80
-		$mountProviderCollection = $server->getMountProviderCollection();
81
-		$notifications = $server->getNotificationManager();
82
-
83
-		/**
84
-		 * Controllers
85
-		 */
86
-		$container->registerService('ShareController', function (SimpleContainer $c) use ($server) {
87
-			$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
88
-			return new ShareController(
89
-				$c->query('AppName'),
90
-				$c->query('Request'),
91
-				$server->getConfig(),
92
-				$server->getURLGenerator(),
93
-				$server->getUserManager(),
94
-				$server->getLogger(),
95
-				$server->getActivityManager(),
96
-				$server->getShareManager(),
97
-				$server->getSession(),
98
-				$server->getPreviewManager(),
99
-				$server->getRootFolder(),
100
-				$federatedSharingApp->getFederatedShareProvider(),
101
-				$server->getEventDispatcher(),
102
-				$server->getL10N($c->query('AppName')),
103
-				$server->query(Defaults::class)
104
-			);
105
-		});
106
-		$container->registerService('ExternalSharesController', function (SimpleContainer $c) {
107
-			return new ExternalSharesController(
108
-				$c->query('AppName'),
109
-				$c->query('Request'),
110
-				$c->query('ExternalManager'),
111
-				$c->query('HttpClientService')
112
-			);
113
-		});
114
-
115
-		/**
116
-		 * Core class wrappers
117
-		 */
118
-		$container->registerService('HttpClientService', function (SimpleContainer $c) use ($server) {
119
-			return $server->getHTTPClientService();
120
-		});
121
-		$container->registerService(ICloudIdManager::class, function (SimpleContainer $c) use ($server) {
122
-			return $server->getCloudIdManager();
123
-		});
124
-		$container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) {
125
-			$user = $server->getUserSession()->getUser();
126
-			$uid = $user ? $user->getUID() : null;
127
-			return new \OCA\Files_Sharing\External\Manager(
128
-				$server->getDatabaseConnection(),
129
-				\OC\Files\Filesystem::getMountManager(),
130
-				\OC\Files\Filesystem::getLoader(),
131
-				$server->getHTTPClientService(),
132
-				$server->getNotificationManager(),
133
-				$server->query(\OCP\OCS\IDiscoveryService::class),
134
-				$server->getCloudFederationProviderManager(),
135
-				$server->getCloudFederationFactory(),
136
-				$server->getGroupManager(),
137
-				$server->getUserManager(),
138
-				$uid
139
-			);
140
-		});
141
-		$container->registerAlias(Manager::class, 'ExternalManager');
142
-
143
-		/**
144
-		 * Middleware
145
-		 */
146
-		$container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use ($server) {
147
-			return new SharingCheckMiddleware(
148
-				$c->query('AppName'),
149
-				$server->getConfig(),
150
-				$server->getAppManager(),
151
-				$server->query(IControllerMethodReflector::class),
152
-				$server->getShareManager(),
153
-				$server->getRequest()
154
-			);
155
-		});
156
-
157
-		$container->registerService(ShareInfoMiddleware::class, function () use ($server) {
158
-			return new ShareInfoMiddleware(
159
-				$server->getShareManager()
160
-			);
161
-		});
162
-
163
-		// Execute middlewares
164
-		$container->registerMiddleWare('SharingCheckMiddleware');
165
-		$container->registerMiddleWare(OCSShareAPIMiddleware::class);
166
-		$container->registerMiddleWare(ShareInfoMiddleware::class);
167
-
168
-		$container->registerService('MountProvider', function (IContainer $c) {
169
-			/** @var \OCP\IServerContainer $server */
170
-			$server = $c->query('ServerContainer');
171
-			return new MountProvider(
172
-				$server->getConfig(),
173
-				$server->getShareManager(),
174
-				$server->getLogger()
175
-			);
176
-		});
177
-
178
-		$container->registerService('ExternalMountProvider', function (IContainer $c) {
179
-			/** @var \OCP\IServerContainer $server */
180
-			$server = $c->query('ServerContainer');
181
-			return new \OCA\Files_Sharing\External\MountProvider(
182
-				$server->getDatabaseConnection(),
183
-				function() use ($c) {
184
-					return $c->query('ExternalManager');
185
-				},
186
-				$server->getCloudIdManager()
187
-			);
188
-		});
189
-
190
-		/**
191
-		 * Register capabilities
192
-		 */
193
-		$container->registerCapability(Capabilities::class);
194
-
195
-		$notifications->registerNotifierService(Notifier::class);
196
-
197
-		$this->registerMountProviders($mountProviderCollection);
198
-		$this->registerEventsScripts($dispatcher);
199
-		$this->setupSharingMenus();
200
-
201
-		/**
202
-		 * Always add main sharing script
203
-		 */
204
-		Util::addScript(self::APP_ID, 'dist/main');
205
-	}
206
-
207
-	protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
208
-		$mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
209
-		$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
210
-	}
211
-
212
-	protected function registerEventsScripts(IEventDispatcher $dispatcher) {
213
-		// sidebar and files scripts
214
-		$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
215
-		$dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
216
-		$dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class);
217
-		$dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() {
218
-			\OCP\Util::addScript('files_sharing', 'dist/collaboration');
219
-		});
220
-		$dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);
221
-		$dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
222
-
223
-		// notifications api to accept incoming user shares
224
-		$dispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) {
225
-			/** @var Listener $listener */
226
-			$listener = $this->getContainer()->query(Listener::class);
227
-			$listener->shareNotification($event);
228
-		});
229
-		$dispatcher->addListener(IGroup::class . '::postAddUser', function(GenericEvent $event) {
230
-			/** @var Listener $listener */
231
-			$listener = $this->getContainer()->query(Listener::class);
232
-			$listener->userAddedToGroup($event);
233
-		});
234
-	}
235
-
236
-	protected function setupSharingMenus() {
237
-		$config = \OC::$server->getConfig();
238
-		$l = \OC::$server->getL10N('files_sharing');
239
-
240
-		if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
241
-			return;
242
-		}
243
-
244
-		$sharingSublistArray = [];
245
-
246
-		if (\OCP\Util::isSharingDisabledForUser() === false) {
247
-			array_push($sharingSublistArray, [
248
-				'id' => 'sharingout',
249
-				'appname' => 'files_sharing',
250
-				'script' => 'list.php',
251
-				'order' => 16,
252
-				'name' => $l->t('Shared with others'),
253
-			]);
254
-		}
255
-
256
-		array_push($sharingSublistArray, [
257
-			'id' => 'sharingin',
258
-			'appname' => 'files_sharing',
259
-			'script' => 'list.php',
260
-			'order' => 15,
261
-			'name' => $l->t('Shared with you'),
262
-		]);
263
-
264
-		if (\OCP\Util::isSharingDisabledForUser() === false) {
265
-			// Check if sharing by link is enabled
266
-			if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
267
-				array_push($sharingSublistArray, [
268
-					'id' => 'sharinglinks',
269
-					'appname' => 'files_sharing',
270
-					'script' => 'list.php',
271
-					'order' => 17,
272
-					'name' => $l->t('Shared by link'),
273
-				]);
274
-			}
275
-		}
276
-
277
-		array_push($sharingSublistArray, [
278
-			'id' => 'deletedshares',
279
-			'appname' => 'files_sharing',
280
-			'script' => 'list.php',
281
-			'order' => 19,
282
-			'name' => $l->t('Deleted shares'),
283
-		]);
284
-
285
-		array_push($sharingSublistArray, [
286
-			'id' => 'pendingshares',
287
-			'appname' => 'files_sharing',
288
-			'script' => 'list.php',
289
-			'order' => 19,
290
-			'name' => $l->t('Pending shares'),
291
-		]);
292
-
293
-
294
-		// show_Quick_Access stored as string
295
-		\OCA\Files\App::getNavigationManager()->add([
296
-			'id' => 'shareoverview',
297
-			'appname' => 'files_sharing',
298
-			'script' => 'list.php',
299
-			'order' => 18,
300
-			'name' => $l->t('Shares'),
301
-			'classes' => 'collapsible',
302
-			'sublist' => $sharingSublistArray,
303
-			'expandedState' => 'show_sharing_menu'
304
-		]);
305
-	}
68
+    const APP_ID = 'files_sharing';
69
+
70
+    public function __construct(array $urlParams = []) {
71
+        parent::__construct(self::APP_ID, $urlParams);
72
+
73
+        $container = $this->getContainer();
74
+
75
+        /** @var IServerContainer $server */
76
+        $server = $container->getServer();
77
+
78
+        /** @var IEventDispatcher $dispatcher */
79
+        $dispatcher = $container->query(IEventDispatcher::class);
80
+        $mountProviderCollection = $server->getMountProviderCollection();
81
+        $notifications = $server->getNotificationManager();
82
+
83
+        /**
84
+         * Controllers
85
+         */
86
+        $container->registerService('ShareController', function (SimpleContainer $c) use ($server) {
87
+            $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
88
+            return new ShareController(
89
+                $c->query('AppName'),
90
+                $c->query('Request'),
91
+                $server->getConfig(),
92
+                $server->getURLGenerator(),
93
+                $server->getUserManager(),
94
+                $server->getLogger(),
95
+                $server->getActivityManager(),
96
+                $server->getShareManager(),
97
+                $server->getSession(),
98
+                $server->getPreviewManager(),
99
+                $server->getRootFolder(),
100
+                $federatedSharingApp->getFederatedShareProvider(),
101
+                $server->getEventDispatcher(),
102
+                $server->getL10N($c->query('AppName')),
103
+                $server->query(Defaults::class)
104
+            );
105
+        });
106
+        $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
107
+            return new ExternalSharesController(
108
+                $c->query('AppName'),
109
+                $c->query('Request'),
110
+                $c->query('ExternalManager'),
111
+                $c->query('HttpClientService')
112
+            );
113
+        });
114
+
115
+        /**
116
+         * Core class wrappers
117
+         */
118
+        $container->registerService('HttpClientService', function (SimpleContainer $c) use ($server) {
119
+            return $server->getHTTPClientService();
120
+        });
121
+        $container->registerService(ICloudIdManager::class, function (SimpleContainer $c) use ($server) {
122
+            return $server->getCloudIdManager();
123
+        });
124
+        $container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) {
125
+            $user = $server->getUserSession()->getUser();
126
+            $uid = $user ? $user->getUID() : null;
127
+            return new \OCA\Files_Sharing\External\Manager(
128
+                $server->getDatabaseConnection(),
129
+                \OC\Files\Filesystem::getMountManager(),
130
+                \OC\Files\Filesystem::getLoader(),
131
+                $server->getHTTPClientService(),
132
+                $server->getNotificationManager(),
133
+                $server->query(\OCP\OCS\IDiscoveryService::class),
134
+                $server->getCloudFederationProviderManager(),
135
+                $server->getCloudFederationFactory(),
136
+                $server->getGroupManager(),
137
+                $server->getUserManager(),
138
+                $uid
139
+            );
140
+        });
141
+        $container->registerAlias(Manager::class, 'ExternalManager');
142
+
143
+        /**
144
+         * Middleware
145
+         */
146
+        $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use ($server) {
147
+            return new SharingCheckMiddleware(
148
+                $c->query('AppName'),
149
+                $server->getConfig(),
150
+                $server->getAppManager(),
151
+                $server->query(IControllerMethodReflector::class),
152
+                $server->getShareManager(),
153
+                $server->getRequest()
154
+            );
155
+        });
156
+
157
+        $container->registerService(ShareInfoMiddleware::class, function () use ($server) {
158
+            return new ShareInfoMiddleware(
159
+                $server->getShareManager()
160
+            );
161
+        });
162
+
163
+        // Execute middlewares
164
+        $container->registerMiddleWare('SharingCheckMiddleware');
165
+        $container->registerMiddleWare(OCSShareAPIMiddleware::class);
166
+        $container->registerMiddleWare(ShareInfoMiddleware::class);
167
+
168
+        $container->registerService('MountProvider', function (IContainer $c) {
169
+            /** @var \OCP\IServerContainer $server */
170
+            $server = $c->query('ServerContainer');
171
+            return new MountProvider(
172
+                $server->getConfig(),
173
+                $server->getShareManager(),
174
+                $server->getLogger()
175
+            );
176
+        });
177
+
178
+        $container->registerService('ExternalMountProvider', function (IContainer $c) {
179
+            /** @var \OCP\IServerContainer $server */
180
+            $server = $c->query('ServerContainer');
181
+            return new \OCA\Files_Sharing\External\MountProvider(
182
+                $server->getDatabaseConnection(),
183
+                function() use ($c) {
184
+                    return $c->query('ExternalManager');
185
+                },
186
+                $server->getCloudIdManager()
187
+            );
188
+        });
189
+
190
+        /**
191
+         * Register capabilities
192
+         */
193
+        $container->registerCapability(Capabilities::class);
194
+
195
+        $notifications->registerNotifierService(Notifier::class);
196
+
197
+        $this->registerMountProviders($mountProviderCollection);
198
+        $this->registerEventsScripts($dispatcher);
199
+        $this->setupSharingMenus();
200
+
201
+        /**
202
+         * Always add main sharing script
203
+         */
204
+        Util::addScript(self::APP_ID, 'dist/main');
205
+    }
206
+
207
+    protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
208
+        $mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
209
+        $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
210
+    }
211
+
212
+    protected function registerEventsScripts(IEventDispatcher $dispatcher) {
213
+        // sidebar and files scripts
214
+        $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
215
+        $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
216
+        $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class);
217
+        $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() {
218
+            \OCP\Util::addScript('files_sharing', 'dist/collaboration');
219
+        });
220
+        $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);
221
+        $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
222
+
223
+        // notifications api to accept incoming user shares
224
+        $dispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) {
225
+            /** @var Listener $listener */
226
+            $listener = $this->getContainer()->query(Listener::class);
227
+            $listener->shareNotification($event);
228
+        });
229
+        $dispatcher->addListener(IGroup::class . '::postAddUser', function(GenericEvent $event) {
230
+            /** @var Listener $listener */
231
+            $listener = $this->getContainer()->query(Listener::class);
232
+            $listener->userAddedToGroup($event);
233
+        });
234
+    }
235
+
236
+    protected function setupSharingMenus() {
237
+        $config = \OC::$server->getConfig();
238
+        $l = \OC::$server->getL10N('files_sharing');
239
+
240
+        if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
241
+            return;
242
+        }
243
+
244
+        $sharingSublistArray = [];
245
+
246
+        if (\OCP\Util::isSharingDisabledForUser() === false) {
247
+            array_push($sharingSublistArray, [
248
+                'id' => 'sharingout',
249
+                'appname' => 'files_sharing',
250
+                'script' => 'list.php',
251
+                'order' => 16,
252
+                'name' => $l->t('Shared with others'),
253
+            ]);
254
+        }
255
+
256
+        array_push($sharingSublistArray, [
257
+            'id' => 'sharingin',
258
+            'appname' => 'files_sharing',
259
+            'script' => 'list.php',
260
+            'order' => 15,
261
+            'name' => $l->t('Shared with you'),
262
+        ]);
263
+
264
+        if (\OCP\Util::isSharingDisabledForUser() === false) {
265
+            // Check if sharing by link is enabled
266
+            if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
267
+                array_push($sharingSublistArray, [
268
+                    'id' => 'sharinglinks',
269
+                    'appname' => 'files_sharing',
270
+                    'script' => 'list.php',
271
+                    'order' => 17,
272
+                    'name' => $l->t('Shared by link'),
273
+                ]);
274
+            }
275
+        }
276
+
277
+        array_push($sharingSublistArray, [
278
+            'id' => 'deletedshares',
279
+            'appname' => 'files_sharing',
280
+            'script' => 'list.php',
281
+            'order' => 19,
282
+            'name' => $l->t('Deleted shares'),
283
+        ]);
284
+
285
+        array_push($sharingSublistArray, [
286
+            'id' => 'pendingshares',
287
+            'appname' => 'files_sharing',
288
+            'script' => 'list.php',
289
+            'order' => 19,
290
+            'name' => $l->t('Pending shares'),
291
+        ]);
292
+
293
+
294
+        // show_Quick_Access stored as string
295
+        \OCA\Files\App::getNavigationManager()->add([
296
+            'id' => 'shareoverview',
297
+            'appname' => 'files_sharing',
298
+            'script' => 'list.php',
299
+            'order' => 18,
300
+            'name' => $l->t('Shares'),
301
+            'classes' => 'collapsible',
302
+            'sublist' => $sharingSublistArray,
303
+            'expandedState' => 'show_sharing_menu'
304
+        ]);
305
+    }
306 306
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Listener/ShareInteractionListener.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -37,59 +37,59 @@
 block discarded – undo
37 37
 
38 38
 class ShareInteractionListener implements IEventListener {
39 39
 
40
-	private const SUPPORTED_SHARE_TYPES = [
41
-		IShare::TYPE_USER,
42
-		IShare::TYPE_EMAIL,
43
-		IShare::TYPE_REMOTE,
44
-	];
40
+    private const SUPPORTED_SHARE_TYPES = [
41
+        IShare::TYPE_USER,
42
+        IShare::TYPE_EMAIL,
43
+        IShare::TYPE_REMOTE,
44
+    ];
45 45
 
46
-	/** @var IEventDispatcher */
47
-	private $dispatcher;
46
+    /** @var IEventDispatcher */
47
+    private $dispatcher;
48 48
 
49
-	/** @var IUserManager */
50
-	private $userManager;
49
+    /** @var IUserManager */
50
+    private $userManager;
51 51
 
52
-	/** @var ILogger */
53
-	private $logger;
52
+    /** @var ILogger */
53
+    private $logger;
54 54
 
55
-	public function __construct(IEventDispatcher $dispatcher,
56
-								IUserManager $userManager,
57
-								ILogger $logger) {
58
-		$this->dispatcher = $dispatcher;
59
-		$this->userManager = $userManager;
60
-		$this->logger = $logger;
61
-	}
55
+    public function __construct(IEventDispatcher $dispatcher,
56
+                                IUserManager $userManager,
57
+                                ILogger $logger) {
58
+        $this->dispatcher = $dispatcher;
59
+        $this->userManager = $userManager;
60
+        $this->logger = $logger;
61
+    }
62 62
 
63
-	public function handle(Event $event): void {
64
-		if (!($event instanceof ShareCreatedEvent)) {
65
-			// Unrelated
66
-			return;
67
-		}
63
+    public function handle(Event $event): void {
64
+        if (!($event instanceof ShareCreatedEvent)) {
65
+            // Unrelated
66
+            return;
67
+        }
68 68
 
69
-		$share = $event->getShare();
70
-		if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) {
71
-			$this->logger->debug('Share type does not allow to emit interaction event');
72
-			return;
73
-		}
74
-		$actor = $this->userManager->get($share->getSharedBy());
75
-		if ($actor === null) {
76
-			$this->logger->warning('Share was not created by a user, can\'t emit interaction event');
77
-			return;
78
-		}
79
-		$interactionEvent = new ContactInteractedWithEvent($actor);
80
-		switch ($share->getShareType()) {
81
-			case IShare::TYPE_USER:
82
-				$interactionEvent->setUid($share->getSharedWith());
83
-				break;
84
-			case IShare::TYPE_EMAIL:
85
-				$interactionEvent->setEmail($share->getSharedWith());
86
-				break;
87
-			case IShare::TYPE_REMOTE:
88
-				$interactionEvent->setFederatedCloudId($share->getSharedWith());
89
-				break;
90
-		}
69
+        $share = $event->getShare();
70
+        if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) {
71
+            $this->logger->debug('Share type does not allow to emit interaction event');
72
+            return;
73
+        }
74
+        $actor = $this->userManager->get($share->getSharedBy());
75
+        if ($actor === null) {
76
+            $this->logger->warning('Share was not created by a user, can\'t emit interaction event');
77
+            return;
78
+        }
79
+        $interactionEvent = new ContactInteractedWithEvent($actor);
80
+        switch ($share->getShareType()) {
81
+            case IShare::TYPE_USER:
82
+                $interactionEvent->setUid($share->getSharedWith());
83
+                break;
84
+            case IShare::TYPE_EMAIL:
85
+                $interactionEvent->setEmail($share->getSharedWith());
86
+                break;
87
+            case IShare::TYPE_REMOTE:
88
+                $interactionEvent->setFederatedCloudId($share->getSharedWith());
89
+                break;
90
+        }
91 91
 
92
-		$this->dispatcher->dispatchTyped($interactionEvent);
93
-	}
92
+        $this->dispatcher->dispatchTyped($interactionEvent);
93
+    }
94 94
 
95 95
 }
Please login to merge, or discard this patch.
lib/public/Contacts/Events/ContactInteractedWithEvent.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -40,97 +40,97 @@
 block discarded – undo
40 40
  */
41 41
 class ContactInteractedWithEvent extends Event {
42 42
 
43
-	/** @var IUser */
44
-	private $actor;
45
-
46
-	/** @var string|null */
47
-	private $uid;
48
-
49
-	/** @var string|null */
50
-	private $email;
51
-
52
-	/** @var string|null */
53
-	private $federatedCloudId;
54
-
55
-	/**
56
-	 * @param IUser $actor the user who started the interaction
57
-	 *
58
-	 * @since 19.0.0
59
-	 */
60
-	public function __construct(IUser $actor) {
61
-		parent::__construct();
62
-		$this->actor = $actor;
63
-	}
64
-
65
-	/**
66
-	 * @return IUser
67
-	 * @since 19.0.0
68
-	 */
69
-	public function getActor(): IUser {
70
-		return $this->actor;
71
-	}
72
-
73
-	/**
74
-	 * @return string|null
75
-	 * @since 19.0.0
76
-	 */
77
-	public function getUid(): ?string {
78
-		return $this->uid;
79
-	}
80
-
81
-	/**
82
-	 * Set the uid of the person interacted with, if known
83
-	 *
84
-	 * @param string $uid
85
-	 *
86
-	 * @return self
87
-	 * @since 19.0.0
88
-	 */
89
-	public function setUid(string $uid): self {
90
-		$this->uid = $uid;
91
-		return $this;
92
-	}
93
-
94
-	/**
95
-	 * @return string|null
96
-	 * @since 19.0.0
97
-	 */
98
-	public function getEmail(): ?string {
99
-		return $this->email;
100
-	}
101
-
102
-	/**
103
-	 * Set the email of the person interacted with, if known
104
-	 *
105
-	 * @param string $email
106
-	 *
107
-	 * @return self
108
-	 * @since 19.0.0
109
-	 */
110
-	public function setEmail(string $email): self {
111
-		$this->email = $email;
112
-		return $this;
113
-	}
114
-
115
-	/**
116
-	 * @return string|null
117
-	 * @since 19.0.0
118
-	 */
119
-	public function getFederatedCloudId(): ?string {
120
-		return $this->federatedCloudId;
121
-	}
122
-
123
-	/**
124
-	 * Set the federated cloud of the person interacted with, if known
125
-	 *
126
-	 * @param string $federatedCloudId
127
-	 *
128
-	 * @return self
129
-	 * @since 19.0.0
130
-	 */
131
-	public function setFederatedCloudId(string $federatedCloudId): self {
132
-		$this->federatedCloudId = $federatedCloudId;
133
-		return $this;
134
-	}
43
+    /** @var IUser */
44
+    private $actor;
45
+
46
+    /** @var string|null */
47
+    private $uid;
48
+
49
+    /** @var string|null */
50
+    private $email;
51
+
52
+    /** @var string|null */
53
+    private $federatedCloudId;
54
+
55
+    /**
56
+     * @param IUser $actor the user who started the interaction
57
+     *
58
+     * @since 19.0.0
59
+     */
60
+    public function __construct(IUser $actor) {
61
+        parent::__construct();
62
+        $this->actor = $actor;
63
+    }
64
+
65
+    /**
66
+     * @return IUser
67
+     * @since 19.0.0
68
+     */
69
+    public function getActor(): IUser {
70
+        return $this->actor;
71
+    }
72
+
73
+    /**
74
+     * @return string|null
75
+     * @since 19.0.0
76
+     */
77
+    public function getUid(): ?string {
78
+        return $this->uid;
79
+    }
80
+
81
+    /**
82
+     * Set the uid of the person interacted with, if known
83
+     *
84
+     * @param string $uid
85
+     *
86
+     * @return self
87
+     * @since 19.0.0
88
+     */
89
+    public function setUid(string $uid): self {
90
+        $this->uid = $uid;
91
+        return $this;
92
+    }
93
+
94
+    /**
95
+     * @return string|null
96
+     * @since 19.0.0
97
+     */
98
+    public function getEmail(): ?string {
99
+        return $this->email;
100
+    }
101
+
102
+    /**
103
+     * Set the email of the person interacted with, if known
104
+     *
105
+     * @param string $email
106
+     *
107
+     * @return self
108
+     * @since 19.0.0
109
+     */
110
+    public function setEmail(string $email): self {
111
+        $this->email = $email;
112
+        return $this;
113
+    }
114
+
115
+    /**
116
+     * @return string|null
117
+     * @since 19.0.0
118
+     */
119
+    public function getFederatedCloudId(): ?string {
120
+        return $this->federatedCloudId;
121
+    }
122
+
123
+    /**
124
+     * Set the federated cloud of the person interacted with, if known
125
+     *
126
+     * @param string $federatedCloudId
127
+     *
128
+     * @return self
129
+     * @since 19.0.0
130
+     */
131
+    public function setFederatedCloudId(string $federatedCloudId): self {
132
+        $this->federatedCloudId = $federatedCloudId;
133
+        return $this;
134
+    }
135 135
 
136 136
 }
Please login to merge, or discard this patch.
core/Command/App/ListApps.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -34,109 +34,109 @@
 block discarded – undo
34 34
 
35 35
 class ListApps extends Base {
36 36
 
37
-	/** @var IAppManager */
38
-	protected $manager;
39
-
40
-	/**
41
-	 * @param IAppManager $manager
42
-	 */
43
-	public function __construct(IAppManager $manager) {
44
-		parent::__construct();
45
-		$this->manager = $manager;
46
-	}
47
-
48
-	protected function configure() {
49
-		parent::configure();
50
-
51
-		$this
52
-			->setName('app:list')
53
-			->setDescription('List all available apps')
54
-			->addOption(
55
-				'shipped',
56
-				null,
57
-				InputOption::VALUE_REQUIRED,
58
-				'true - limit to shipped apps only, false - limit to non-shipped apps only'
59
-			)
60
-		;
61
-	}
62
-
63
-	protected function execute(InputInterface $input, OutputInterface $output) {
64
-		if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
65
-			$shippedFilter = $input->getOption('shipped') === 'true';
66
-		} else {
67
-			$shippedFilter = null;
68
-		}
69
-
70
-		$apps = \OC_App::getAllApps();
71
-		$enabledApps = $disabledApps = [];
72
-		$versions = \OC_App::getAppVersions();
73
-
74
-		//sort enabled apps above disabled apps
75
-		foreach ($apps as $app) {
76
-			if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
77
-				continue;
78
-			}
79
-			if ($this->manager->isInstalled($app)) {
80
-				$enabledApps[] = $app;
81
-			} else {
82
-				$disabledApps[] = $app;
83
-			}
84
-		}
85
-
86
-		$apps = ['enabled' => [], 'disabled' => []];
87
-
88
-		sort($enabledApps);
89
-		foreach ($enabledApps as $app) {
90
-			$apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
91
-		}
92
-
93
-		sort($disabledApps);
94
-		foreach ($disabledApps as $app) {
95
-			$apps['disabled'][$app] = null;
96
-		}
97
-
98
-		$this->writeAppList($input, $output, $apps);
99
-	}
100
-
101
-	/**
102
-	 * @param InputInterface $input
103
-	 * @param OutputInterface $output
104
-	 * @param array $items
105
-	 */
106
-	protected function writeAppList(InputInterface $input, OutputInterface $output, $items) {
107
-		switch ($input->getOption('output')) {
108
-			case self::OUTPUT_FORMAT_PLAIN:
109
-				$output->writeln('Enabled:');
110
-				parent::writeArrayInOutputFormat($input, $output, $items['enabled']);
111
-
112
-				$output->writeln('Disabled:');
113
-				parent::writeArrayInOutputFormat($input, $output, $items['disabled']);
114
-			break;
115
-
116
-			default:
117
-				parent::writeArrayInOutputFormat($input, $output, $items);
118
-			break;
119
-		}
120
-	}
121
-
122
-	/**
123
-	 * @param string $optionName
124
-	 * @param CompletionContext $completionContext
125
-	 * @return array
126
-	 */
127
-	public function completeOptionValues($optionName, CompletionContext $completionContext) {
128
-		if ($optionName === 'shipped') {
129
-			return ['true', 'false'];
130
-		}
131
-		return [];
132
-	}
133
-
134
-	/**
135
-	 * @param string $argumentName
136
-	 * @param CompletionContext $context
137
-	 * @return string[]
138
-	 */
139
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
140
-		return [];
141
-	}
37
+    /** @var IAppManager */
38
+    protected $manager;
39
+
40
+    /**
41
+     * @param IAppManager $manager
42
+     */
43
+    public function __construct(IAppManager $manager) {
44
+        parent::__construct();
45
+        $this->manager = $manager;
46
+    }
47
+
48
+    protected function configure() {
49
+        parent::configure();
50
+
51
+        $this
52
+            ->setName('app:list')
53
+            ->setDescription('List all available apps')
54
+            ->addOption(
55
+                'shipped',
56
+                null,
57
+                InputOption::VALUE_REQUIRED,
58
+                'true - limit to shipped apps only, false - limit to non-shipped apps only'
59
+            )
60
+        ;
61
+    }
62
+
63
+    protected function execute(InputInterface $input, OutputInterface $output) {
64
+        if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
65
+            $shippedFilter = $input->getOption('shipped') === 'true';
66
+        } else {
67
+            $shippedFilter = null;
68
+        }
69
+
70
+        $apps = \OC_App::getAllApps();
71
+        $enabledApps = $disabledApps = [];
72
+        $versions = \OC_App::getAppVersions();
73
+
74
+        //sort enabled apps above disabled apps
75
+        foreach ($apps as $app) {
76
+            if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
77
+                continue;
78
+            }
79
+            if ($this->manager->isInstalled($app)) {
80
+                $enabledApps[] = $app;
81
+            } else {
82
+                $disabledApps[] = $app;
83
+            }
84
+        }
85
+
86
+        $apps = ['enabled' => [], 'disabled' => []];
87
+
88
+        sort($enabledApps);
89
+        foreach ($enabledApps as $app) {
90
+            $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
91
+        }
92
+
93
+        sort($disabledApps);
94
+        foreach ($disabledApps as $app) {
95
+            $apps['disabled'][$app] = null;
96
+        }
97
+
98
+        $this->writeAppList($input, $output, $apps);
99
+    }
100
+
101
+    /**
102
+     * @param InputInterface $input
103
+     * @param OutputInterface $output
104
+     * @param array $items
105
+     */
106
+    protected function writeAppList(InputInterface $input, OutputInterface $output, $items) {
107
+        switch ($input->getOption('output')) {
108
+            case self::OUTPUT_FORMAT_PLAIN:
109
+                $output->writeln('Enabled:');
110
+                parent::writeArrayInOutputFormat($input, $output, $items['enabled']);
111
+
112
+                $output->writeln('Disabled:');
113
+                parent::writeArrayInOutputFormat($input, $output, $items['disabled']);
114
+            break;
115
+
116
+            default:
117
+                parent::writeArrayInOutputFormat($input, $output, $items);
118
+            break;
119
+        }
120
+    }
121
+
122
+    /**
123
+     * @param string $optionName
124
+     * @param CompletionContext $completionContext
125
+     * @return array
126
+     */
127
+    public function completeOptionValues($optionName, CompletionContext $completionContext) {
128
+        if ($optionName === 'shipped') {
129
+            return ['true', 'false'];
130
+        }
131
+        return [];
132
+    }
133
+
134
+    /**
135
+     * @param string $argumentName
136
+     * @param CompletionContext $context
137
+     * @return string[]
138
+     */
139
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
140
+        return [];
141
+    }
142 142
 }
Please login to merge, or discard this patch.