Passed
Push — master ( 4a4262...32927f )
by Roeland
24:24 queued 11:41
created
apps/user_ldap/appinfo/routes.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 $application->registerRoutes($this, [
42 42
 	'ocs' => [
43 43
 		['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
44
-		['name' => 'ConfigAPI#show',   'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
44
+		['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
45 45
 		['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
46 46
 		['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
47 47
 	]
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,37 +29,37 @@
 block discarded – undo
29 29
 
30 30
 /** @var $this \OCP\Route\IRouter */
31 31
 $this->create('user_ldap_ajax_clearMappings', 'apps/user_ldap/ajax/clearMappings.php')
32
-	->actionInclude('user_ldap/ajax/clearMappings.php');
32
+    ->actionInclude('user_ldap/ajax/clearMappings.php');
33 33
 $this->create('user_ldap_ajax_deleteConfiguration', 'apps/user_ldap/ajax/deleteConfiguration.php')
34
-	->actionInclude('user_ldap/ajax/deleteConfiguration.php');
34
+    ->actionInclude('user_ldap/ajax/deleteConfiguration.php');
35 35
 $this->create('user_ldap_ajax_getConfiguration', 'apps/user_ldap/ajax/getConfiguration.php')
36
-	->actionInclude('user_ldap/ajax/getConfiguration.php');
36
+    ->actionInclude('user_ldap/ajax/getConfiguration.php');
37 37
 $this->create('user_ldap_ajax_getNewServerConfigPrefix', 'apps/user_ldap/ajax/getNewServerConfigPrefix.php')
38
-	->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php');
38
+    ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php');
39 39
 $this->create('user_ldap_ajax_setConfiguration', 'apps/user_ldap/ajax/setConfiguration.php')
40
-	->actionInclude('user_ldap/ajax/setConfiguration.php');
40
+    ->actionInclude('user_ldap/ajax/setConfiguration.php');
41 41
 $this->create('user_ldap_ajax_testConfiguration', 'apps/user_ldap/ajax/testConfiguration.php')
42
-	->actionInclude('user_ldap/ajax/testConfiguration.php');
42
+    ->actionInclude('user_ldap/ajax/testConfiguration.php');
43 43
 $this->create('user_ldap_ajax_wizard', 'apps/user_ldap/ajax/wizard.php')
44
-	->actionInclude('user_ldap/ajax/wizard.php');
44
+    ->actionInclude('user_ldap/ajax/wizard.php');
45 45
 
46 46
 $application = new \OCP\AppFramework\App('user_ldap');
47 47
 $application->registerRoutes($this, [
48
-	'ocs' => [
49
-		['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
50
-		['name' => 'ConfigAPI#show',   'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
51
-		['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
52
-		['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
53
-	]
48
+    'ocs' => [
49
+        ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
50
+        ['name' => 'ConfigAPI#show',   'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
51
+        ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
52
+        ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
53
+    ]
54 54
 ]);
55 55
 
56 56
 /** @var \OCA\User_LDAP\AppInfo\Application $application */
57 57
 $application = \OC::$server->query(\OCA\User_LDAP\AppInfo\Application::class);
58 58
 $application->registerRoutes($this, [
59
-	'routes' => [
60
-		['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
61
-		['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'],
62
-		['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'],
63
-		['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'],
64
-	]
59
+    'routes' => [
60
+        ['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
61
+        ['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'],
62
+        ['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'],
63
+        ['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'],
64
+    ]
65 65
 ]);
Please login to merge, or discard this patch.
apps/files_external/ajax/applicable.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@
 block discarded – undo
30 30
 $limit = null;
31 31
 $offset = null;
32 32
 if (isset($_GET['pattern'])) {
33
-	$pattern = (string)$_GET['pattern'];
33
+	$pattern = (string) $_GET['pattern'];
34 34
 }
35 35
 if (isset($_GET['limit'])) {
36
-	$limit = (int)$_GET['limit'];
36
+	$limit = (int) $_GET['limit'];
37 37
 }
38 38
 if (isset($_GET['offset'])) {
39
-	$offset = (int)$_GET['offset'];
39
+	$offset = (int) $_GET['offset'];
40 40
 }
41 41
 
42 42
 $groups = [];
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
32 32
 $limit = null;
33 33
 $offset = null;
34 34
 if (isset($_GET['pattern'])) {
35
-	$pattern = (string)$_GET['pattern'];
35
+    $pattern = (string)$_GET['pattern'];
36 36
 }
37 37
 if (isset($_GET['limit'])) {
38
-	$limit = (int)$_GET['limit'];
38
+    $limit = (int)$_GET['limit'];
39 39
 }
40 40
 if (isset($_GET['offset'])) {
41
-	$offset = (int)$_GET['offset'];
41
+    $offset = (int)$_GET['offset'];
42 42
 }
43 43
 
44 44
 $groups = [];
45 45
 foreach (\OC::$server->getGroupManager()->search($pattern, $limit, $offset) as $group) {
46
-	$groups[$group->getGID()] = $group->getDisplayName();
46
+    $groups[$group->getGID()] = $group->getDisplayName();
47 47
 }
48 48
 
49 49
 $users = [];
50 50
 foreach (\OC::$server->getUserManager()->searchDisplayName($pattern, $limit, $offset) as $user) {
51
-	$users[$user->getUID()] = $user->getDisplayName();
51
+    $users[$user->getUID()] = $user->getDisplayName();
52 52
 }
53 53
 
54 54
 $results = ['groups' => $groups, 'users' => $users];
Please login to merge, or discard this patch.
apps/files_external/lib/Service/ImportLegacyStoragesService.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@
 block discarded – undo
24 24
 namespace OCA\Files_External\Service;
25 25
 
26 26
 class ImportLegacyStoragesService extends LegacyStoragesService {
27
-	private $data;
27
+    private $data;
28 28
 
29
-	/**
30
-	 * @param BackendService $backendService
31
-	 */
32
-	public function __construct(BackendService $backendService) {
33
-		$this->backendService = $backendService;
34
-	}
29
+    /**
30
+     * @param BackendService $backendService
31
+     */
32
+    public function __construct(BackendService $backendService) {
33
+        $this->backendService = $backendService;
34
+    }
35 35
 
36
-	public function setData($data) {
37
-		$this->data = $data;
38
-	}
36
+    public function setData($data) {
37
+        $this->data = $data;
38
+    }
39 39
 
40
-	/**
41
-	 * Read legacy config data
42
-	 *
43
-	 * @return array list of mount configs
44
-	 */
45
-	protected function readLegacyConfig() {
46
-		return $this->data;
47
-	}
40
+    /**
41
+     * Read legacy config data
42
+     *
43
+     * @return array list of mount configs
44
+     */
45
+    protected function readLegacyConfig() {
46
+        return $this->data;
47
+    }
48 48
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Service/UserGlobalStoragesService.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$result = [];
116 116
 		foreach ($storagesByMountpoint as $storageList) {
117
-			$storage = array_reduce($storageList, function ($carry, $item) {
117
+			$storage = array_reduce($storageList, function($carry, $item) {
118 118
 				if (isset($carry)) {
119 119
 					$carryPriorityType = $this->getPriorityType($carry);
120 120
 					$itemPriorityType = $this->getPriorityType($item);
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 		$groupIds = $this->groupManager->getUserGroupIds($this->getUser());
187 187
 		$mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds);
188 188
 		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
189
-		$configs = array_filter($configs, function ($config) {
189
+		$configs = array_filter($configs, function($config) {
190 190
 			return $config instanceof StorageConfig;
191 191
 		});
192 192
 
193
-		$keys = array_map(function (StorageConfig $config) {
193
+		$keys = array_map(function(StorageConfig $config) {
194 194
 			return $config->getId();
195 195
 		}, $configs);
196 196
 
Please login to merge, or discard this patch.
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -33,167 +33,167 @@
 block discarded – undo
33 33
  * Read-only access available, attempting to write will throw DomainException
34 34
  */
35 35
 class UserGlobalStoragesService extends GlobalStoragesService {
36
-	use UserTrait;
37
-
38
-	/** @var IGroupManager */
39
-	protected $groupManager;
40
-
41
-	/**
42
-	 * @param BackendService $backendService
43
-	 * @param DBConfigService $dbConfig
44
-	 * @param IUserSession $userSession
45
-	 * @param IGroupManager $groupManager
46
-	 * @param IUserMountCache $userMountCache
47
-	 */
48
-	public function __construct(
49
-		BackendService $backendService,
50
-		DBConfigService $dbConfig,
51
-		IUserSession $userSession,
52
-		IGroupManager $groupManager,
53
-		IUserMountCache $userMountCache
54
-	) {
55
-		parent::__construct($backendService, $dbConfig, $userMountCache);
56
-		$this->userSession = $userSession;
57
-		$this->groupManager = $groupManager;
58
-	}
59
-
60
-	/**
61
-	 * Replace config hash ID with real IDs, for migrating legacy storages
62
-	 *
63
-	 * @param StorageConfig[] $storages Storages with real IDs
64
-	 * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs
65
-	 */
66
-	protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) {
67
-		// as a read-only view, storage IDs don't need to be real
68
-		foreach ($storagesWithConfigHash as $storage) {
69
-			$storages[$storage->getId()] = $storage;
70
-		}
71
-	}
72
-
73
-	protected function readDBConfig() {
74
-		$userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID());
75
-		$globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null);
76
-		$groups = $this->groupManager->getUserGroupIds($this->getUser());
77
-		if (is_array($groups) && count($groups) !== 0) {
78
-			$groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups);
79
-		} else {
80
-			$groupMounts = [];
81
-		}
82
-		return array_merge($userMounts, $groupMounts, $globalMounts);
83
-	}
84
-
85
-	public function addStorage(StorageConfig $newStorage) {
86
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
87
-	}
88
-
89
-	public function updateStorage(StorageConfig $updatedStorage) {
90
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
91
-	}
92
-
93
-	/**
94
-	 * @param integer $id
95
-	 */
96
-	public function removeStorage($id) {
97
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
98
-	}
99
-
100
-	/**
101
-	 * Get unique storages, in case two are defined with the same mountpoint
102
-	 * Higher priority storages take precedence
103
-	 *
104
-	 * @return StorageConfig[]
105
-	 */
106
-	public function getUniqueStorages() {
107
-		$storages = $this->getStorages();
108
-
109
-		$storagesByMountpoint = [];
110
-		foreach ($storages as $storage) {
111
-			$storagesByMountpoint[$storage->getMountPoint()][] = $storage;
112
-		}
113
-
114
-		$result = [];
115
-		foreach ($storagesByMountpoint as $storageList) {
116
-			$storage = array_reduce($storageList, function ($carry, $item) {
117
-				if (isset($carry)) {
118
-					$carryPriorityType = $this->getPriorityType($carry);
119
-					$itemPriorityType = $this->getPriorityType($item);
120
-					if ($carryPriorityType > $itemPriorityType) {
121
-						return $carry;
122
-					} elseif ($carryPriorityType === $itemPriorityType) {
123
-						if ($carry->getPriority() > $item->getPriority()) {
124
-							return $carry;
125
-						}
126
-					}
127
-				}
128
-				return $item;
129
-			});
130
-			$result[$storage->getID()] = $storage;
131
-		}
132
-
133
-		return $result;
134
-	}
135
-
136
-	/**
137
-	 * Get a priority 'type', where a bigger number means higher priority
138
-	 * user applicable > group applicable > 'all'
139
-	 *
140
-	 * @param StorageConfig $storage
141
-	 * @return int
142
-	 */
143
-	protected function getPriorityType(StorageConfig $storage) {
144
-		$applicableUsers = $storage->getApplicableUsers();
145
-		$applicableGroups = $storage->getApplicableGroups();
146
-
147
-		if ($applicableUsers && $applicableUsers[0] !== 'all') {
148
-			return 2;
149
-		}
150
-		if ($applicableGroups) {
151
-			return 1;
152
-		}
153
-		return 0;
154
-	}
155
-
156
-	protected function isApplicable(StorageConfig $config) {
157
-		$applicableUsers = $config->getApplicableUsers();
158
-		$applicableGroups = $config->getApplicableGroups();
159
-
160
-		if (count($applicableUsers) === 0 && count($applicableGroups) === 0) {
161
-			return true;
162
-		}
163
-		if (in_array($this->getUser()->getUID(), $applicableUsers, true)) {
164
-			return true;
165
-		}
166
-		$groupIds = $this->groupManager->getUserGroupIds($this->getUser());
167
-		foreach ($groupIds as $groupId) {
168
-			if (in_array($groupId, $applicableGroups, true)) {
169
-				return true;
170
-			}
171
-		}
172
-		return false;
173
-	}
174
-
175
-
176
-	/**
177
-	 * Gets all storages for the user, admin, personal, global, etc
178
-	 *
179
-	 * @return StorageConfig[] array of storage configs
180
-	 */
181
-	public function getAllStoragesForUser() {
182
-		if (is_null($this->getUser())) {
183
-			return [];
184
-		}
185
-		$groupIds = $this->groupManager->getUserGroupIds($this->getUser());
186
-		$mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds);
187
-		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
188
-		$configs = array_filter($configs, function ($config) {
189
-			return $config instanceof StorageConfig;
190
-		});
191
-
192
-		$keys = array_map(function (StorageConfig $config) {
193
-			return $config->getId();
194
-		}, $configs);
195
-
196
-		$storages = array_combine($keys, $configs);
197
-		return array_filter($storages, [$this, 'validateStorage']);
198
-	}
36
+    use UserTrait;
37
+
38
+    /** @var IGroupManager */
39
+    protected $groupManager;
40
+
41
+    /**
42
+     * @param BackendService $backendService
43
+     * @param DBConfigService $dbConfig
44
+     * @param IUserSession $userSession
45
+     * @param IGroupManager $groupManager
46
+     * @param IUserMountCache $userMountCache
47
+     */
48
+    public function __construct(
49
+        BackendService $backendService,
50
+        DBConfigService $dbConfig,
51
+        IUserSession $userSession,
52
+        IGroupManager $groupManager,
53
+        IUserMountCache $userMountCache
54
+    ) {
55
+        parent::__construct($backendService, $dbConfig, $userMountCache);
56
+        $this->userSession = $userSession;
57
+        $this->groupManager = $groupManager;
58
+    }
59
+
60
+    /**
61
+     * Replace config hash ID with real IDs, for migrating legacy storages
62
+     *
63
+     * @param StorageConfig[] $storages Storages with real IDs
64
+     * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs
65
+     */
66
+    protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) {
67
+        // as a read-only view, storage IDs don't need to be real
68
+        foreach ($storagesWithConfigHash as $storage) {
69
+            $storages[$storage->getId()] = $storage;
70
+        }
71
+    }
72
+
73
+    protected function readDBConfig() {
74
+        $userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID());
75
+        $globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null);
76
+        $groups = $this->groupManager->getUserGroupIds($this->getUser());
77
+        if (is_array($groups) && count($groups) !== 0) {
78
+            $groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups);
79
+        } else {
80
+            $groupMounts = [];
81
+        }
82
+        return array_merge($userMounts, $groupMounts, $globalMounts);
83
+    }
84
+
85
+    public function addStorage(StorageConfig $newStorage) {
86
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
87
+    }
88
+
89
+    public function updateStorage(StorageConfig $updatedStorage) {
90
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
91
+    }
92
+
93
+    /**
94
+     * @param integer $id
95
+     */
96
+    public function removeStorage($id) {
97
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
98
+    }
99
+
100
+    /**
101
+     * Get unique storages, in case two are defined with the same mountpoint
102
+     * Higher priority storages take precedence
103
+     *
104
+     * @return StorageConfig[]
105
+     */
106
+    public function getUniqueStorages() {
107
+        $storages = $this->getStorages();
108
+
109
+        $storagesByMountpoint = [];
110
+        foreach ($storages as $storage) {
111
+            $storagesByMountpoint[$storage->getMountPoint()][] = $storage;
112
+        }
113
+
114
+        $result = [];
115
+        foreach ($storagesByMountpoint as $storageList) {
116
+            $storage = array_reduce($storageList, function ($carry, $item) {
117
+                if (isset($carry)) {
118
+                    $carryPriorityType = $this->getPriorityType($carry);
119
+                    $itemPriorityType = $this->getPriorityType($item);
120
+                    if ($carryPriorityType > $itemPriorityType) {
121
+                        return $carry;
122
+                    } elseif ($carryPriorityType === $itemPriorityType) {
123
+                        if ($carry->getPriority() > $item->getPriority()) {
124
+                            return $carry;
125
+                        }
126
+                    }
127
+                }
128
+                return $item;
129
+            });
130
+            $result[$storage->getID()] = $storage;
131
+        }
132
+
133
+        return $result;
134
+    }
135
+
136
+    /**
137
+     * Get a priority 'type', where a bigger number means higher priority
138
+     * user applicable > group applicable > 'all'
139
+     *
140
+     * @param StorageConfig $storage
141
+     * @return int
142
+     */
143
+    protected function getPriorityType(StorageConfig $storage) {
144
+        $applicableUsers = $storage->getApplicableUsers();
145
+        $applicableGroups = $storage->getApplicableGroups();
146
+
147
+        if ($applicableUsers && $applicableUsers[0] !== 'all') {
148
+            return 2;
149
+        }
150
+        if ($applicableGroups) {
151
+            return 1;
152
+        }
153
+        return 0;
154
+    }
155
+
156
+    protected function isApplicable(StorageConfig $config) {
157
+        $applicableUsers = $config->getApplicableUsers();
158
+        $applicableGroups = $config->getApplicableGroups();
159
+
160
+        if (count($applicableUsers) === 0 && count($applicableGroups) === 0) {
161
+            return true;
162
+        }
163
+        if (in_array($this->getUser()->getUID(), $applicableUsers, true)) {
164
+            return true;
165
+        }
166
+        $groupIds = $this->groupManager->getUserGroupIds($this->getUser());
167
+        foreach ($groupIds as $groupId) {
168
+            if (in_array($groupId, $applicableGroups, true)) {
169
+                return true;
170
+            }
171
+        }
172
+        return false;
173
+    }
174
+
175
+
176
+    /**
177
+     * Gets all storages for the user, admin, personal, global, etc
178
+     *
179
+     * @return StorageConfig[] array of storage configs
180
+     */
181
+    public function getAllStoragesForUser() {
182
+        if (is_null($this->getUser())) {
183
+            return [];
184
+        }
185
+        $groupIds = $this->groupManager->getUserGroupIds($this->getUser());
186
+        $mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds);
187
+        $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
188
+        $configs = array_filter($configs, function ($config) {
189
+            return $config instanceof StorageConfig;
190
+        });
191
+
192
+        $keys = array_map(function (StorageConfig $config) {
193
+            return $config->getId();
194
+        }, $configs);
195
+
196
+        $storages = array_combine($keys, $configs);
197
+        return array_filter($storages, [$this, 'validateStorage']);
198
+    }
199 199
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Service/GlobalStoragesService.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -35,151 +35,151 @@
 block discarded – undo
35 35
  * Service class to manage global external storages
36 36
  */
37 37
 class GlobalStoragesService extends StoragesService {
38
-	/**
39
-	 * Triggers $signal for all applicable users of the given
40
-	 * storage
41
-	 *
42
-	 * @param StorageConfig $storage storage data
43
-	 * @param string $signal signal to trigger
44
-	 */
45
-	protected function triggerHooks(StorageConfig $storage, $signal) {
46
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
47
-		$applicableUsers = $storage->getApplicableUsers();
48
-		$applicableGroups = $storage->getApplicableGroups();
49
-		if (empty($applicableUsers) && empty($applicableGroups)) {
50
-			// raise for user "all"
51
-			$this->triggerApplicableHooks(
52
-				$signal,
53
-				$storage->getMountPoint(),
54
-				\OC_Mount_Config::MOUNT_TYPE_USER,
55
-				['all']
56
-			);
57
-			return;
58
-		}
59
-
60
-		$this->triggerApplicableHooks(
61
-			$signal,
62
-			$storage->getMountPoint(),
63
-			\OC_Mount_Config::MOUNT_TYPE_USER,
64
-			$applicableUsers
65
-		);
66
-		$this->triggerApplicableHooks(
67
-			$signal,
68
-			$storage->getMountPoint(),
69
-			\OC_Mount_Config::MOUNT_TYPE_GROUP,
70
-			$applicableGroups
71
-		);
72
-	}
73
-
74
-	/**
75
-	 * Triggers signal_create_mount or signal_delete_mount to
76
-	 * accommodate for additions/deletions in applicableUsers
77
-	 * and applicableGroups fields.
78
-	 *
79
-	 * @param StorageConfig $oldStorage old storage config
80
-	 * @param StorageConfig $newStorage new storage config
81
-	 */
82
-	protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) {
83
-		// if mount point changed, it's like a deletion + creation
84
-		if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) {
85
-			$this->triggerHooks($oldStorage, Filesystem::signal_delete_mount);
86
-			$this->triggerHooks($newStorage, Filesystem::signal_create_mount);
87
-			return;
88
-		}
89
-
90
-		$userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers());
91
-		$userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers());
92
-		$groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups());
93
-		$groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups());
94
-
95
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
96
-		// if no applicable were set, raise a signal for "all"
97
-		$oldApplicableUsers = $oldStorage->getApplicableUsers();
98
-		$oldApplicableGroups = $oldStorage->getApplicableGroups();
99
-		if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) {
100
-			$this->triggerApplicableHooks(
101
-				Filesystem::signal_delete_mount,
102
-				$oldStorage->getMountPoint(),
103
-				\OC_Mount_Config::MOUNT_TYPE_USER,
104
-				['all']
105
-			);
106
-		}
107
-
108
-		// trigger delete for removed users
109
-		$this->triggerApplicableHooks(
110
-			Filesystem::signal_delete_mount,
111
-			$oldStorage->getMountPoint(),
112
-			\OC_Mount_Config::MOUNT_TYPE_USER,
113
-			$userDeletions
114
-		);
115
-
116
-		// trigger delete for removed groups
117
-		$this->triggerApplicableHooks(
118
-			Filesystem::signal_delete_mount,
119
-			$oldStorage->getMountPoint(),
120
-			\OC_Mount_Config::MOUNT_TYPE_GROUP,
121
-			$groupDeletions
122
-		);
123
-
124
-		// and now add the new users
125
-		$this->triggerApplicableHooks(
126
-			Filesystem::signal_create_mount,
127
-			$newStorage->getMountPoint(),
128
-			\OC_Mount_Config::MOUNT_TYPE_USER,
129
-			$userAdditions
130
-		);
131
-
132
-		// and now add the new groups
133
-		$this->triggerApplicableHooks(
134
-			Filesystem::signal_create_mount,
135
-			$newStorage->getMountPoint(),
136
-			\OC_Mount_Config::MOUNT_TYPE_GROUP,
137
-			$groupAdditions
138
-		);
139
-
140
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
141
-		// if no applicable, raise a signal for "all"
142
-		$newApplicableUsers = $newStorage->getApplicableUsers();
143
-		$newApplicableGroups = $newStorage->getApplicableGroups();
144
-		if (empty($newApplicableUsers) && empty($newApplicableGroups)) {
145
-			$this->triggerApplicableHooks(
146
-				Filesystem::signal_create_mount,
147
-				$newStorage->getMountPoint(),
148
-				\OC_Mount_Config::MOUNT_TYPE_USER,
149
-				['all']
150
-			);
151
-		}
152
-	}
153
-
154
-	/**
155
-	 * Get the visibility type for this controller, used in validation
156
-	 *
157
-	 * @return string BackendService::VISIBILITY_* constants
158
-	 */
159
-	public function getVisibilityType() {
160
-		return BackendService::VISIBILITY_ADMIN;
161
-	}
162
-
163
-	protected function isApplicable(StorageConfig $config) {
164
-		return true;
165
-	}
166
-
167
-	/**
168
-	 * Get all configured admin and personal mounts
169
-	 *
170
-	 * @return array map of storage id to storage config
171
-	 */
172
-	public function getStorageForAllUsers() {
173
-		$mounts = $this->dbConfig->getAllMounts();
174
-		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
175
-		$configs = array_filter($configs, function ($config) {
176
-			return $config instanceof StorageConfig;
177
-		});
178
-
179
-		$keys = array_map(function (StorageConfig $config) {
180
-			return $config->getId();
181
-		}, $configs);
182
-
183
-		return array_combine($keys, $configs);
184
-	}
38
+    /**
39
+     * Triggers $signal for all applicable users of the given
40
+     * storage
41
+     *
42
+     * @param StorageConfig $storage storage data
43
+     * @param string $signal signal to trigger
44
+     */
45
+    protected function triggerHooks(StorageConfig $storage, $signal) {
46
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
47
+        $applicableUsers = $storage->getApplicableUsers();
48
+        $applicableGroups = $storage->getApplicableGroups();
49
+        if (empty($applicableUsers) && empty($applicableGroups)) {
50
+            // raise for user "all"
51
+            $this->triggerApplicableHooks(
52
+                $signal,
53
+                $storage->getMountPoint(),
54
+                \OC_Mount_Config::MOUNT_TYPE_USER,
55
+                ['all']
56
+            );
57
+            return;
58
+        }
59
+
60
+        $this->triggerApplicableHooks(
61
+            $signal,
62
+            $storage->getMountPoint(),
63
+            \OC_Mount_Config::MOUNT_TYPE_USER,
64
+            $applicableUsers
65
+        );
66
+        $this->triggerApplicableHooks(
67
+            $signal,
68
+            $storage->getMountPoint(),
69
+            \OC_Mount_Config::MOUNT_TYPE_GROUP,
70
+            $applicableGroups
71
+        );
72
+    }
73
+
74
+    /**
75
+     * Triggers signal_create_mount or signal_delete_mount to
76
+     * accommodate for additions/deletions in applicableUsers
77
+     * and applicableGroups fields.
78
+     *
79
+     * @param StorageConfig $oldStorage old storage config
80
+     * @param StorageConfig $newStorage new storage config
81
+     */
82
+    protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) {
83
+        // if mount point changed, it's like a deletion + creation
84
+        if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) {
85
+            $this->triggerHooks($oldStorage, Filesystem::signal_delete_mount);
86
+            $this->triggerHooks($newStorage, Filesystem::signal_create_mount);
87
+            return;
88
+        }
89
+
90
+        $userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers());
91
+        $userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers());
92
+        $groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups());
93
+        $groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups());
94
+
95
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
96
+        // if no applicable were set, raise a signal for "all"
97
+        $oldApplicableUsers = $oldStorage->getApplicableUsers();
98
+        $oldApplicableGroups = $oldStorage->getApplicableGroups();
99
+        if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) {
100
+            $this->triggerApplicableHooks(
101
+                Filesystem::signal_delete_mount,
102
+                $oldStorage->getMountPoint(),
103
+                \OC_Mount_Config::MOUNT_TYPE_USER,
104
+                ['all']
105
+            );
106
+        }
107
+
108
+        // trigger delete for removed users
109
+        $this->triggerApplicableHooks(
110
+            Filesystem::signal_delete_mount,
111
+            $oldStorage->getMountPoint(),
112
+            \OC_Mount_Config::MOUNT_TYPE_USER,
113
+            $userDeletions
114
+        );
115
+
116
+        // trigger delete for removed groups
117
+        $this->triggerApplicableHooks(
118
+            Filesystem::signal_delete_mount,
119
+            $oldStorage->getMountPoint(),
120
+            \OC_Mount_Config::MOUNT_TYPE_GROUP,
121
+            $groupDeletions
122
+        );
123
+
124
+        // and now add the new users
125
+        $this->triggerApplicableHooks(
126
+            Filesystem::signal_create_mount,
127
+            $newStorage->getMountPoint(),
128
+            \OC_Mount_Config::MOUNT_TYPE_USER,
129
+            $userAdditions
130
+        );
131
+
132
+        // and now add the new groups
133
+        $this->triggerApplicableHooks(
134
+            Filesystem::signal_create_mount,
135
+            $newStorage->getMountPoint(),
136
+            \OC_Mount_Config::MOUNT_TYPE_GROUP,
137
+            $groupAdditions
138
+        );
139
+
140
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
141
+        // if no applicable, raise a signal for "all"
142
+        $newApplicableUsers = $newStorage->getApplicableUsers();
143
+        $newApplicableGroups = $newStorage->getApplicableGroups();
144
+        if (empty($newApplicableUsers) && empty($newApplicableGroups)) {
145
+            $this->triggerApplicableHooks(
146
+                Filesystem::signal_create_mount,
147
+                $newStorage->getMountPoint(),
148
+                \OC_Mount_Config::MOUNT_TYPE_USER,
149
+                ['all']
150
+            );
151
+        }
152
+    }
153
+
154
+    /**
155
+     * Get the visibility type for this controller, used in validation
156
+     *
157
+     * @return string BackendService::VISIBILITY_* constants
158
+     */
159
+    public function getVisibilityType() {
160
+        return BackendService::VISIBILITY_ADMIN;
161
+    }
162
+
163
+    protected function isApplicable(StorageConfig $config) {
164
+        return true;
165
+    }
166
+
167
+    /**
168
+     * Get all configured admin and personal mounts
169
+     *
170
+     * @return array map of storage id to storage config
171
+     */
172
+    public function getStorageForAllUsers() {
173
+        $mounts = $this->dbConfig->getAllMounts();
174
+        $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
175
+        $configs = array_filter($configs, function ($config) {
176
+            return $config instanceof StorageConfig;
177
+        });
178
+
179
+        $keys = array_map(function (StorageConfig $config) {
180
+            return $config->getId();
181
+        }, $configs);
182
+
183
+        return array_combine($keys, $configs);
184
+    }
185 185
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,11 +172,11 @@
 block discarded – undo
172 172
 	public function getStorageForAllUsers() {
173 173
 		$mounts = $this->dbConfig->getAllMounts();
174 174
 		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
175
-		$configs = array_filter($configs, function ($config) {
175
+		$configs = array_filter($configs, function($config) {
176 176
 			return $config instanceof StorageConfig;
177 177
 		});
178 178
 
179
-		$keys = array_map(function (StorageConfig $config) {
179
+		$keys = array_map(function(StorageConfig $config) {
180 180
 			return $config->getId();
181 181
 		}, $configs);
182 182
 
Please login to merge, or discard this patch.
apps/files_external/lib/Service/UserLegacyStoragesService.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@
 block discarded – undo
29 29
  * Read user defined mounts from the legacy mount.json
30 30
  */
31 31
 class UserLegacyStoragesService extends LegacyStoragesService {
32
-	/**
33
-	 * @var IUserSession
34
-	 */
35
-	private $userSession;
32
+    /**
33
+     * @var IUserSession
34
+     */
35
+    private $userSession;
36 36
 
37
-	/**
38
-	 * @param BackendService $backendService
39
-	 * @param IUserSession $userSession
40
-	 */
41
-	public function __construct(BackendService $backendService, IUserSession $userSession) {
42
-		$this->backendService = $backendService;
43
-		$this->userSession = $userSession;
44
-	}
37
+    /**
38
+     * @param BackendService $backendService
39
+     * @param IUserSession $userSession
40
+     */
41
+    public function __construct(BackendService $backendService, IUserSession $userSession) {
42
+        $this->backendService = $backendService;
43
+        $this->userSession = $userSession;
44
+    }
45 45
 
46
-	/**
47
-	 * Read legacy config data
48
-	 *
49
-	 * @return array list of storage configs
50
-	 */
51
-	protected function readLegacyConfig() {
52
-		// read user config
53
-		$user = $this->userSession->getUser()->getUID();
54
-		return \OC_Mount_Config::readData($user);
55
-	}
46
+    /**
47
+     * Read legacy config data
48
+     *
49
+     * @return array list of storage configs
50
+     */
51
+    protected function readLegacyConfig() {
52
+        // read user config
53
+        $user = $this->userSession->getUser()->getUID();
54
+        return \OC_Mount_Config::readData($user);
55
+    }
56 56
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Service/UserTrait.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -30,46 +30,46 @@
 block discarded – undo
30 30
  */
31 31
 trait UserTrait {
32 32
 
33
-	/** @var IUserSession */
34
-	protected $userSession;
33
+    /** @var IUserSession */
34
+    protected $userSession;
35 35
 
36
-	/**
37
-	 * User override
38
-	 *
39
-	 * @var IUser|null
40
-	 */
41
-	private $user = null;
36
+    /**
37
+     * User override
38
+     *
39
+     * @var IUser|null
40
+     */
41
+    private $user = null;
42 42
 
43
-	/**
44
-	 * @return IUser|null
45
-	 */
46
-	protected function getUser() {
47
-		if ($this->user) {
48
-			return $this->user;
49
-		}
50
-		return $this->userSession->getUser();
51
-	}
43
+    /**
44
+     * @return IUser|null
45
+     */
46
+    protected function getUser() {
47
+        if ($this->user) {
48
+            return $this->user;
49
+        }
50
+        return $this->userSession->getUser();
51
+    }
52 52
 
53
-	/**
54
-	 * Override the user from the session
55
-	 * Unset with ->resetUser() when finished!
56
-	 *
57
-	 * @param IUser
58
-	 * @return self
59
-	 */
60
-	public function setUser(IUser $user) {
61
-		$this->user = $user;
62
-		return $this;
63
-	}
53
+    /**
54
+     * Override the user from the session
55
+     * Unset with ->resetUser() when finished!
56
+     *
57
+     * @param IUser
58
+     * @return self
59
+     */
60
+    public function setUser(IUser $user) {
61
+        $this->user = $user;
62
+        return $this;
63
+    }
64 64
 
65
-	/**
66
-	 * Reset the user override
67
-	 *
68
-	 * @return self
69
-	 */
70
-	public function resetUser() {
71
-		$this->user = null;
72
-		return $this;
73
-	}
65
+    /**
66
+     * Reset the user override
67
+     *
68
+     * @return self
69
+     */
70
+    public function resetUser() {
71
+        $this->user = null;
72
+        return $this;
73
+    }
74 74
 }
75 75
 
Please login to merge, or discard this patch.
apps/files_external/lib/Command/Applicable.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		try {
104 104
 			$mount = $this->globalService->getStorage($mountId);
105 105
 		} catch (NotFoundException $e) {
106
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts</error>');
106
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts</error>');
107 107
 			return 404;
108 108
 		}
109 109
 
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 		if ((count($addUsers) + count($removeUsers) + count($addGroups) + count($removeGroups) > 0) || $input->getOption('remove-all')) {
124 124
 			foreach ($addUsers as $addUser) {
125 125
 				if (!$this->userManager->userExists($addUser)) {
126
-					$output->writeln('<error>User "' . $addUser . '" not found</error>');
126
+					$output->writeln('<error>User "'.$addUser.'" not found</error>');
127 127
 					return 404;
128 128
 				}
129 129
 			}
130 130
 			foreach ($addGroups as $addGroup) {
131 131
 				if (!$this->groupManager->groupExists($addGroup)) {
132
-					$output->writeln('<error>Group "' . $addGroup . '" not found</error>');
132
+					$output->writeln('<error>Group "'.$addGroup.'" not found</error>');
133 133
 					return 404;
134 134
 				}
135 135
 			}
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -37,123 +37,123 @@
 block discarded – undo
37 37
 use Symfony\Component\Console\Output\OutputInterface;
38 38
 
39 39
 class Applicable extends Base {
40
-	/**
41
-	 * @var GlobalStoragesService
42
-	 */
43
-	protected $globalService;
40
+    /**
41
+     * @var GlobalStoragesService
42
+     */
43
+    protected $globalService;
44 44
 
45
-	/**
46
-	 * @var IUserManager
47
-	 */
48
-	private $userManager;
45
+    /**
46
+     * @var IUserManager
47
+     */
48
+    private $userManager;
49 49
 
50
-	/**
51
-	 * @var IGroupManager
52
-	 */
53
-	private $groupManager;
50
+    /**
51
+     * @var IGroupManager
52
+     */
53
+    private $groupManager;
54 54
 
55
-	public function __construct(
56
-		GlobalStoragesService $globalService,
57
-		IUserManager $userManager,
58
-		IGroupManager $groupManager
59
-	) {
60
-		parent::__construct();
61
-		$this->globalService = $globalService;
62
-		$this->userManager = $userManager;
63
-		$this->groupManager = $groupManager;
64
-	}
55
+    public function __construct(
56
+        GlobalStoragesService $globalService,
57
+        IUserManager $userManager,
58
+        IGroupManager $groupManager
59
+    ) {
60
+        parent::__construct();
61
+        $this->globalService = $globalService;
62
+        $this->userManager = $userManager;
63
+        $this->groupManager = $groupManager;
64
+    }
65 65
 
66
-	protected function configure() {
67
-		$this
68
-			->setName('files_external:applicable')
69
-			->setDescription('Manage applicable users and groups for a mount')
70
-			->addArgument(
71
-				'mount_id',
72
-				InputArgument::REQUIRED,
73
-				'The id of the mount to edit'
74
-			)->addOption(
75
-				'add-user',
76
-				'',
77
-				InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
78
-				'user to add as applicable'
79
-			)->addOption(
80
-				'remove-user',
81
-				'',
82
-				InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
83
-				'user to remove as applicable'
84
-			)->addOption(
85
-				'add-group',
86
-				'',
87
-				InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
88
-				'group to add as applicable'
89
-			)->addOption(
90
-				'remove-group',
91
-				'',
92
-				InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
93
-				'group to remove as applicable'
94
-			)->addOption(
95
-				'remove-all',
96
-				'',
97
-				InputOption::VALUE_NONE,
98
-				'Set the mount to be globally applicable'
99
-			);
100
-		parent::configure();
101
-	}
66
+    protected function configure() {
67
+        $this
68
+            ->setName('files_external:applicable')
69
+            ->setDescription('Manage applicable users and groups for a mount')
70
+            ->addArgument(
71
+                'mount_id',
72
+                InputArgument::REQUIRED,
73
+                'The id of the mount to edit'
74
+            )->addOption(
75
+                'add-user',
76
+                '',
77
+                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
78
+                'user to add as applicable'
79
+            )->addOption(
80
+                'remove-user',
81
+                '',
82
+                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
83
+                'user to remove as applicable'
84
+            )->addOption(
85
+                'add-group',
86
+                '',
87
+                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
88
+                'group to add as applicable'
89
+            )->addOption(
90
+                'remove-group',
91
+                '',
92
+                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
93
+                'group to remove as applicable'
94
+            )->addOption(
95
+                'remove-all',
96
+                '',
97
+                InputOption::VALUE_NONE,
98
+                'Set the mount to be globally applicable'
99
+            );
100
+        parent::configure();
101
+    }
102 102
 
103
-	protected function execute(InputInterface $input, OutputInterface $output): int {
104
-		$mountId = $input->getArgument('mount_id');
105
-		try {
106
-			$mount = $this->globalService->getStorage($mountId);
107
-		} catch (NotFoundException $e) {
108
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts</error>');
109
-			return 404;
110
-		}
103
+    protected function execute(InputInterface $input, OutputInterface $output): int {
104
+        $mountId = $input->getArgument('mount_id');
105
+        try {
106
+            $mount = $this->globalService->getStorage($mountId);
107
+        } catch (NotFoundException $e) {
108
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts</error>');
109
+            return 404;
110
+        }
111 111
 
112
-		if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
113
-			$output->writeln('<error>Can\'t change applicables on personal mounts</error>');
114
-			return 1;
115
-		}
112
+        if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
113
+            $output->writeln('<error>Can\'t change applicables on personal mounts</error>');
114
+            return 1;
115
+        }
116 116
 
117
-		$addUsers = $input->getOption('add-user');
118
-		$removeUsers = $input->getOption('remove-user');
119
-		$addGroups = $input->getOption('add-group');
120
-		$removeGroups = $input->getOption('remove-group');
117
+        $addUsers = $input->getOption('add-user');
118
+        $removeUsers = $input->getOption('remove-user');
119
+        $addGroups = $input->getOption('add-group');
120
+        $removeGroups = $input->getOption('remove-group');
121 121
 
122
-		$applicableUsers = $mount->getApplicableUsers();
123
-		$applicableGroups = $mount->getApplicableGroups();
122
+        $applicableUsers = $mount->getApplicableUsers();
123
+        $applicableGroups = $mount->getApplicableGroups();
124 124
 
125
-		if ((count($addUsers) + count($removeUsers) + count($addGroups) + count($removeGroups) > 0) || $input->getOption('remove-all')) {
126
-			foreach ($addUsers as $addUser) {
127
-				if (!$this->userManager->userExists($addUser)) {
128
-					$output->writeln('<error>User "' . $addUser . '" not found</error>');
129
-					return 404;
130
-				}
131
-			}
132
-			foreach ($addGroups as $addGroup) {
133
-				if (!$this->groupManager->groupExists($addGroup)) {
134
-					$output->writeln('<error>Group "' . $addGroup . '" not found</error>');
135
-					return 404;
136
-				}
137
-			}
125
+        if ((count($addUsers) + count($removeUsers) + count($addGroups) + count($removeGroups) > 0) || $input->getOption('remove-all')) {
126
+            foreach ($addUsers as $addUser) {
127
+                if (!$this->userManager->userExists($addUser)) {
128
+                    $output->writeln('<error>User "' . $addUser . '" not found</error>');
129
+                    return 404;
130
+                }
131
+            }
132
+            foreach ($addGroups as $addGroup) {
133
+                if (!$this->groupManager->groupExists($addGroup)) {
134
+                    $output->writeln('<error>Group "' . $addGroup . '" not found</error>');
135
+                    return 404;
136
+                }
137
+            }
138 138
 
139
-			if ($input->getOption('remove-all')) {
140
-				$applicableUsers = [];
141
-				$applicableGroups = [];
142
-			} else {
143
-				$applicableUsers = array_unique(array_merge($applicableUsers, $addUsers));
144
-				$applicableUsers = array_values(array_diff($applicableUsers, $removeUsers));
145
-				$applicableGroups = array_unique(array_merge($applicableGroups, $addGroups));
146
-				$applicableGroups = array_values(array_diff($applicableGroups, $removeGroups));
147
-			}
148
-			$mount->setApplicableUsers($applicableUsers);
149
-			$mount->setApplicableGroups($applicableGroups);
150
-			$this->globalService->updateStorage($mount);
151
-		}
139
+            if ($input->getOption('remove-all')) {
140
+                $applicableUsers = [];
141
+                $applicableGroups = [];
142
+            } else {
143
+                $applicableUsers = array_unique(array_merge($applicableUsers, $addUsers));
144
+                $applicableUsers = array_values(array_diff($applicableUsers, $removeUsers));
145
+                $applicableGroups = array_unique(array_merge($applicableGroups, $addGroups));
146
+                $applicableGroups = array_values(array_diff($applicableGroups, $removeGroups));
147
+            }
148
+            $mount->setApplicableUsers($applicableUsers);
149
+            $mount->setApplicableGroups($applicableGroups);
150
+            $this->globalService->updateStorage($mount);
151
+        }
152 152
 
153
-		$this->writeArrayInOutputFormat($input, $output, [
154
-			'users' => $applicableUsers,
155
-			'groups' => $applicableGroups
156
-		]);
157
-		return 0;
158
-	}
153
+        $this->writeArrayInOutputFormat($input, $output, [
154
+            'users' => $applicableUsers,
155
+            'groups' => $applicableGroups
156
+        ]);
157
+        return 0;
158
+    }
159 159
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Command/Config.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		try {
69 69
 			$mount = $this->globalService->getStorage($mountId);
70 70
 		} catch (NotFoundException $e) {
71
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
71
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>');
72 72
 			return 404;
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -34,88 +34,88 @@
 block discarded – undo
34 34
 use Symfony\Component\Console\Output\OutputInterface;
35 35
 
36 36
 class Config extends Base {
37
-	/**
38
-	 * @var GlobalStoragesService
39
-	 */
40
-	protected $globalService;
37
+    /**
38
+     * @var GlobalStoragesService
39
+     */
40
+    protected $globalService;
41 41
 
42
-	public function __construct(GlobalStoragesService $globalService) {
43
-		parent::__construct();
44
-		$this->globalService = $globalService;
45
-	}
42
+    public function __construct(GlobalStoragesService $globalService) {
43
+        parent::__construct();
44
+        $this->globalService = $globalService;
45
+    }
46 46
 
47
-	protected function configure() {
48
-		$this
49
-			->setName('files_external:config')
50
-			->setDescription('Manage backend configuration for a mount')
51
-			->addArgument(
52
-				'mount_id',
53
-				InputArgument::REQUIRED,
54
-				'The id of the mount to edit'
55
-			)->addArgument(
56
-				'key',
57
-				InputArgument::REQUIRED,
58
-				'key of the config option to set/get'
59
-			)->addArgument(
60
-				'value',
61
-				InputArgument::OPTIONAL,
62
-				'value to set the config option to, when no value is provided the existing value will be printed'
63
-			);
64
-		parent::configure();
65
-	}
47
+    protected function configure() {
48
+        $this
49
+            ->setName('files_external:config')
50
+            ->setDescription('Manage backend configuration for a mount')
51
+            ->addArgument(
52
+                'mount_id',
53
+                InputArgument::REQUIRED,
54
+                'The id of the mount to edit'
55
+            )->addArgument(
56
+                'key',
57
+                InputArgument::REQUIRED,
58
+                'key of the config option to set/get'
59
+            )->addArgument(
60
+                'value',
61
+                InputArgument::OPTIONAL,
62
+                'value to set the config option to, when no value is provided the existing value will be printed'
63
+            );
64
+        parent::configure();
65
+    }
66 66
 
67
-	protected function execute(InputInterface $input, OutputInterface $output): int {
68
-		$mountId = $input->getArgument('mount_id');
69
-		$key = $input->getArgument('key');
70
-		try {
71
-			$mount = $this->globalService->getStorage($mountId);
72
-		} catch (NotFoundException $e) {
73
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
74
-			return 404;
75
-		}
67
+    protected function execute(InputInterface $input, OutputInterface $output): int {
68
+        $mountId = $input->getArgument('mount_id');
69
+        $key = $input->getArgument('key');
70
+        try {
71
+            $mount = $this->globalService->getStorage($mountId);
72
+        } catch (NotFoundException $e) {
73
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
74
+            return 404;
75
+        }
76 76
 
77
-		$value = $input->getArgument('value');
78
-		if ($value !== null) {
79
-			$this->setOption($mount, $key, $value, $output);
80
-		} else {
81
-			$this->getOption($mount, $key, $output);
82
-		}
83
-		return 0;
84
-	}
77
+        $value = $input->getArgument('value');
78
+        if ($value !== null) {
79
+            $this->setOption($mount, $key, $value, $output);
80
+        } else {
81
+            $this->getOption($mount, $key, $output);
82
+        }
83
+        return 0;
84
+    }
85 85
 
86
-	/**
87
-	 * @param StorageConfig $mount
88
-	 * @param string $key
89
-	 * @param OutputInterface $output
90
-	 */
91
-	protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
92
-		if ($key === 'mountpoint' || $key === 'mount_point') {
93
-			$value = $mount->getMountPoint();
94
-		} else {
95
-			$value = $mount->getBackendOption($key);
96
-		}
97
-		if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
98
-			$value = json_encode($value);
99
-		}
100
-		$output->writeln($value);
101
-	}
86
+    /**
87
+     * @param StorageConfig $mount
88
+     * @param string $key
89
+     * @param OutputInterface $output
90
+     */
91
+    protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
92
+        if ($key === 'mountpoint' || $key === 'mount_point') {
93
+            $value = $mount->getMountPoint();
94
+        } else {
95
+            $value = $mount->getBackendOption($key);
96
+        }
97
+        if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
98
+            $value = json_encode($value);
99
+        }
100
+        $output->writeln($value);
101
+    }
102 102
 
103
-	/**
104
-	 * @param StorageConfig $mount
105
-	 * @param string $key
106
-	 * @param string $value
107
-	 * @param OutputInterface $output
108
-	 */
109
-	protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
110
-		$decoded = json_decode($value, true);
111
-		if (!is_null($decoded) && json_encode($decoded) === $value) {
112
-			$value = $decoded;
113
-		}
114
-		if ($key === 'mountpoint' || $key === 'mount_point') {
115
-			$mount->setMountPoint($value);
116
-		} else {
117
-			$mount->setBackendOption($key, $value);
118
-		}
119
-		$this->globalService->updateStorage($mount);
120
-	}
103
+    /**
104
+     * @param StorageConfig $mount
105
+     * @param string $key
106
+     * @param string $value
107
+     * @param OutputInterface $output
108
+     */
109
+    protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
110
+        $decoded = json_decode($value, true);
111
+        if (!is_null($decoded) && json_encode($decoded) === $value) {
112
+            $value = $decoded;
113
+        }
114
+        if ($key === 'mountpoint' || $key === 'mount_point') {
115
+            $mount->setMountPoint($value);
116
+        } else {
117
+            $mount->setBackendOption($key, $value);
118
+        }
119
+        $this->globalService->updateStorage($mount);
120
+    }
121 121
 }
Please login to merge, or discard this patch.