Passed
Push — master ( a169bd...ce314d )
by Morris
25:36 queued 14:17
created
apps/files_sharing/lib/Hooks.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -31,37 +31,37 @@
 block discarded – undo
31 31
 use OCP\EventDispatcher\IEventDispatcher;
32 32
 
33 33
 class Hooks {
34
-	public static function deleteUser($params) {
35
-		$manager = new External\Manager(
36
-			\OC::$server->getDatabaseConnection(),
37
-			\OC\Files\Filesystem::getMountManager(),
38
-			\OC\Files\Filesystem::getLoader(),
39
-			\OC::$server->getHTTPClientService(),
40
-			\OC::$server->getNotificationManager(),
41
-			\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
42
-			\OC::$server->getCloudFederationProviderManager(),
43
-			\OC::$server->getCloudFederationFactory(),
44
-			\OC::$server->getGroupManager(),
45
-			\OC::$server->getUserManager(),
46
-			$params['uid'],
47
-			\OC::$server->query(IEventDispatcher::class)
48
-		);
34
+    public static function deleteUser($params) {
35
+        $manager = new External\Manager(
36
+            \OC::$server->getDatabaseConnection(),
37
+            \OC\Files\Filesystem::getMountManager(),
38
+            \OC\Files\Filesystem::getLoader(),
39
+            \OC::$server->getHTTPClientService(),
40
+            \OC::$server->getNotificationManager(),
41
+            \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
42
+            \OC::$server->getCloudFederationProviderManager(),
43
+            \OC::$server->getCloudFederationFactory(),
44
+            \OC::$server->getGroupManager(),
45
+            \OC::$server->getUserManager(),
46
+            $params['uid'],
47
+            \OC::$server->query(IEventDispatcher::class)
48
+        );
49 49
 
50
-		$manager->removeUserShares($params['uid']);
51
-	}
50
+        $manager->removeUserShares($params['uid']);
51
+    }
52 52
 
53
-	public static function unshareChildren($params) {
54
-		$path = Filesystem::getView()->getAbsolutePath($params['path']);
55
-		$view = new \OC\Files\View('/');
53
+    public static function unshareChildren($params) {
54
+        $path = Filesystem::getView()->getAbsolutePath($params['path']);
55
+        $view = new \OC\Files\View('/');
56 56
 
57
-		// find share mount points within $path and unmount them
58
-		$mountManager = \OC\Files\Filesystem::getMountManager();
59
-		$mountedShares = $mountManager->findIn($path);
60
-		foreach ($mountedShares as $mount) {
61
-			if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
62
-				$mountPoint = $mount->getMountPoint();
63
-				$view->unlink($mountPoint);
64
-			}
65
-		}
66
-	}
57
+        // find share mount points within $path and unmount them
58
+        $mountManager = \OC\Files\Filesystem::getMountManager();
59
+        $mountedShares = $mountManager->findIn($path);
60
+        foreach ($mountedShares as $mount) {
61
+            if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
62
+                $mountPoint = $mount->getMountPoint();
63
+                $view->unlink($mountPoint);
64
+            }
65
+        }
66
+    }
67 67
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/AppInfo/Application.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -62,178 +62,178 @@
 block discarded – undo
62 62
 use Symfony\Component\EventDispatcher\GenericEvent;
63 63
 
64 64
 class Application extends App {
65
-	public const APP_ID = 'files_sharing';
66
-
67
-	public function __construct(array $urlParams = []) {
68
-		parent::__construct(self::APP_ID, $urlParams);
69
-
70
-		$container = $this->getContainer();
71
-
72
-		/** @var IServerContainer $server */
73
-		$server = $container->getServer();
74
-
75
-		/** @var IEventDispatcher $dispatcher */
76
-		$dispatcher = $container->query(IEventDispatcher::class);
77
-		$mountProviderCollection = $server->getMountProviderCollection();
78
-		$notifications = $server->getNotificationManager();
79
-
80
-		/**
81
-		 * Core class wrappers
82
-		 */
83
-		$container->registerService(Manager::class, function (SimpleContainer $c) use ($server) {
84
-			$user = $server->getUserSession()->getUser();
85
-			$uid = $user ? $user->getUID() : null;
86
-			return new \OCA\Files_Sharing\External\Manager(
87
-				$server->getDatabaseConnection(),
88
-				\OC\Files\Filesystem::getMountManager(),
89
-				\OC\Files\Filesystem::getLoader(),
90
-				$server->getHTTPClientService(),
91
-				$server->getNotificationManager(),
92
-				$server->query(\OCP\OCS\IDiscoveryService::class),
93
-				$server->getCloudFederationProviderManager(),
94
-				$server->getCloudFederationFactory(),
95
-				$server->getGroupManager(),
96
-				$server->getUserManager(),
97
-				$uid,
98
-				$server->query(IEventDispatcher::class)
99
-			);
100
-		});
101
-
102
-		/**
103
-		 * Middleware
104
-		 */
105
-		$container->registerMiddleWare(SharingCheckMiddleware::class);
106
-		$container->registerMiddleWare(OCSShareAPIMiddleware::class);
107
-		$container->registerMiddleWare(ShareInfoMiddleware::class);
108
-
109
-		$container->registerService('ExternalMountProvider', function (ContainerInterface $c) {
110
-			return new \OCA\Files_Sharing\External\MountProvider(
111
-				$c->get(IDBConnection::class),
112
-				function () use ($c) {
113
-					return $c->get(Manager::class);
114
-				},
115
-				$c->get(ICloudIdManager::class)
116
-			);
117
-		});
118
-
119
-		/**
120
-		 * Register capabilities
121
-		 */
122
-		$container->registerCapability(Capabilities::class);
123
-
124
-		$notifications->registerNotifierService(Notifier::class);
125
-
126
-		$this->registerMountProviders($mountProviderCollection);
127
-		$this->registerEventsScripts($dispatcher);
128
-		$this->setupSharingMenus();
129
-
130
-		/**
131
-		 * Always add main sharing script
132
-		 */
133
-		Util::addScript(self::APP_ID, 'dist/main');
134
-	}
135
-
136
-	protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
137
-		$mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
138
-		$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
139
-	}
140
-
141
-	protected function registerEventsScripts(IEventDispatcher $dispatcher) {
142
-		// sidebar and files scripts
143
-		$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
144
-		$dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class);
145
-		$dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
146
-		$dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class);
147
-		$dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
148
-			\OCP\Util::addScript('files_sharing', 'dist/collaboration');
149
-		});
150
-		$dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);
151
-		$dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
152
-
153
-		// notifications api to accept incoming user shares
154
-		$dispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) {
155
-			/** @var Listener $listener */
156
-			$listener = $this->getContainer()->query(Listener::class);
157
-			$listener->shareNotification($event);
158
-		});
159
-		$dispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) {
160
-			/** @var Listener $listener */
161
-			$listener = $this->getContainer()->query(Listener::class);
162
-			$listener->userAddedToGroup($event);
163
-		});
164
-	}
165
-
166
-	protected function setupSharingMenus() {
167
-		$config = \OC::$server->getConfig();
168
-
169
-		if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
170
-			return;
171
-		}
172
-
173
-		// show_Quick_Access stored as string
174
-		\OCA\Files\App::getNavigationManager()->add(function () {
175
-			$config = \OC::$server->getConfig();
176
-			$l = \OC::$server->getL10N('files_sharing');
177
-
178
-			$sharingSublistArray = [];
179
-
180
-			if (\OCP\Util::isSharingDisabledForUser() === false) {
181
-				$sharingSublistArray[] = [
182
-					'id' => 'sharingout',
183
-					'appname' => 'files_sharing',
184
-					'script' => 'list.php',
185
-					'order' => 16,
186
-					'name' => $l->t('Shared with others'),
187
-				];
188
-			}
189
-
190
-			$sharingSublistArray[] = [
191
-				'id' => 'sharingin',
192
-				'appname' => 'files_sharing',
193
-				'script' => 'list.php',
194
-				'order' => 15,
195
-				'name' => $l->t('Shared with you'),
196
-			];
197
-
198
-			if (\OCP\Util::isSharingDisabledForUser() === false) {
199
-				// Check if sharing by link is enabled
200
-				if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
201
-					$sharingSublistArray[] = [
202
-						'id' => 'sharinglinks',
203
-						'appname' => 'files_sharing',
204
-						'script' => 'list.php',
205
-						'order' => 17,
206
-						'name' => $l->t('Shared by link'),
207
-					];
208
-				}
209
-			}
210
-
211
-			$sharingSublistArray[] = [
212
-				'id' => 'deletedshares',
213
-				'appname' => 'files_sharing',
214
-				'script' => 'list.php',
215
-				'order' => 19,
216
-				'name' => $l->t('Deleted shares'),
217
-			];
218
-
219
-			$sharingSublistArray[] = [
220
-				'id' => 'pendingshares',
221
-				'appname' => 'files_sharing',
222
-				'script' => 'list.php',
223
-				'order' => 19,
224
-				'name' => $l->t('Pending shares'),
225
-			];
226
-
227
-			return [
228
-				'id' => 'shareoverview',
229
-				'appname' => 'files_sharing',
230
-				'script' => 'list.php',
231
-				'order' => 18,
232
-				'name' => $l->t('Shares'),
233
-				'classes' => 'collapsible',
234
-				'sublist' => $sharingSublistArray,
235
-				'expandedState' => 'show_sharing_menu'
236
-			];
237
-		});
238
-	}
65
+    public const APP_ID = 'files_sharing';
66
+
67
+    public function __construct(array $urlParams = []) {
68
+        parent::__construct(self::APP_ID, $urlParams);
69
+
70
+        $container = $this->getContainer();
71
+
72
+        /** @var IServerContainer $server */
73
+        $server = $container->getServer();
74
+
75
+        /** @var IEventDispatcher $dispatcher */
76
+        $dispatcher = $container->query(IEventDispatcher::class);
77
+        $mountProviderCollection = $server->getMountProviderCollection();
78
+        $notifications = $server->getNotificationManager();
79
+
80
+        /**
81
+         * Core class wrappers
82
+         */
83
+        $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) {
84
+            $user = $server->getUserSession()->getUser();
85
+            $uid = $user ? $user->getUID() : null;
86
+            return new \OCA\Files_Sharing\External\Manager(
87
+                $server->getDatabaseConnection(),
88
+                \OC\Files\Filesystem::getMountManager(),
89
+                \OC\Files\Filesystem::getLoader(),
90
+                $server->getHTTPClientService(),
91
+                $server->getNotificationManager(),
92
+                $server->query(\OCP\OCS\IDiscoveryService::class),
93
+                $server->getCloudFederationProviderManager(),
94
+                $server->getCloudFederationFactory(),
95
+                $server->getGroupManager(),
96
+                $server->getUserManager(),
97
+                $uid,
98
+                $server->query(IEventDispatcher::class)
99
+            );
100
+        });
101
+
102
+        /**
103
+         * Middleware
104
+         */
105
+        $container->registerMiddleWare(SharingCheckMiddleware::class);
106
+        $container->registerMiddleWare(OCSShareAPIMiddleware::class);
107
+        $container->registerMiddleWare(ShareInfoMiddleware::class);
108
+
109
+        $container->registerService('ExternalMountProvider', function (ContainerInterface $c) {
110
+            return new \OCA\Files_Sharing\External\MountProvider(
111
+                $c->get(IDBConnection::class),
112
+                function () use ($c) {
113
+                    return $c->get(Manager::class);
114
+                },
115
+                $c->get(ICloudIdManager::class)
116
+            );
117
+        });
118
+
119
+        /**
120
+         * Register capabilities
121
+         */
122
+        $container->registerCapability(Capabilities::class);
123
+
124
+        $notifications->registerNotifierService(Notifier::class);
125
+
126
+        $this->registerMountProviders($mountProviderCollection);
127
+        $this->registerEventsScripts($dispatcher);
128
+        $this->setupSharingMenus();
129
+
130
+        /**
131
+         * Always add main sharing script
132
+         */
133
+        Util::addScript(self::APP_ID, 'dist/main');
134
+    }
135
+
136
+    protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
137
+        $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
138
+        $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
139
+    }
140
+
141
+    protected function registerEventsScripts(IEventDispatcher $dispatcher) {
142
+        // sidebar and files scripts
143
+        $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
144
+        $dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class);
145
+        $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
146
+        $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class);
147
+        $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
148
+            \OCP\Util::addScript('files_sharing', 'dist/collaboration');
149
+        });
150
+        $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);
151
+        $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
152
+
153
+        // notifications api to accept incoming user shares
154
+        $dispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) {
155
+            /** @var Listener $listener */
156
+            $listener = $this->getContainer()->query(Listener::class);
157
+            $listener->shareNotification($event);
158
+        });
159
+        $dispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) {
160
+            /** @var Listener $listener */
161
+            $listener = $this->getContainer()->query(Listener::class);
162
+            $listener->userAddedToGroup($event);
163
+        });
164
+    }
165
+
166
+    protected function setupSharingMenus() {
167
+        $config = \OC::$server->getConfig();
168
+
169
+        if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
170
+            return;
171
+        }
172
+
173
+        // show_Quick_Access stored as string
174
+        \OCA\Files\App::getNavigationManager()->add(function () {
175
+            $config = \OC::$server->getConfig();
176
+            $l = \OC::$server->getL10N('files_sharing');
177
+
178
+            $sharingSublistArray = [];
179
+
180
+            if (\OCP\Util::isSharingDisabledForUser() === false) {
181
+                $sharingSublistArray[] = [
182
+                    'id' => 'sharingout',
183
+                    'appname' => 'files_sharing',
184
+                    'script' => 'list.php',
185
+                    'order' => 16,
186
+                    'name' => $l->t('Shared with others'),
187
+                ];
188
+            }
189
+
190
+            $sharingSublistArray[] = [
191
+                'id' => 'sharingin',
192
+                'appname' => 'files_sharing',
193
+                'script' => 'list.php',
194
+                'order' => 15,
195
+                'name' => $l->t('Shared with you'),
196
+            ];
197
+
198
+            if (\OCP\Util::isSharingDisabledForUser() === false) {
199
+                // Check if sharing by link is enabled
200
+                if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
201
+                    $sharingSublistArray[] = [
202
+                        'id' => 'sharinglinks',
203
+                        'appname' => 'files_sharing',
204
+                        'script' => 'list.php',
205
+                        'order' => 17,
206
+                        'name' => $l->t('Shared by link'),
207
+                    ];
208
+                }
209
+            }
210
+
211
+            $sharingSublistArray[] = [
212
+                'id' => 'deletedshares',
213
+                'appname' => 'files_sharing',
214
+                'script' => 'list.php',
215
+                'order' => 19,
216
+                'name' => $l->t('Deleted shares'),
217
+            ];
218
+
219
+            $sharingSublistArray[] = [
220
+                'id' => 'pendingshares',
221
+                'appname' => 'files_sharing',
222
+                'script' => 'list.php',
223
+                'order' => 19,
224
+                'name' => $l->t('Pending shares'),
225
+            ];
226
+
227
+            return [
228
+                'id' => 'shareoverview',
229
+                'appname' => 'files_sharing',
230
+                'script' => 'list.php',
231
+                'order' => 18,
232
+                'name' => $l->t('Shares'),
233
+                'classes' => 'collapsible',
234
+                'sublist' => $sharingSublistArray,
235
+                'expandedState' => 'show_sharing_menu'
236
+            ];
237
+        });
238
+    }
239 239
 }
Please login to merge, or discard this patch.