Passed
Push — master ( 197711...e06532 )
by Julius
15:26 queued 12s
created
apps/user_ldap/lib/IUserLDAP.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,26 +24,26 @@
 block discarded – undo
24 24
 
25 25
 interface IUserLDAP {
26 26
 
27
-	//Functions used by LDAPProvider
27
+    //Functions used by LDAPProvider
28 28
 	
29
-	/**
30
-	 * Return access for LDAP interaction.
31
-	 * @param string $uid
32
-	 * @return Access instance of Access for LDAP interaction
33
-	 */
34
-	public function getLDAPAccess($uid);
29
+    /**
30
+     * Return access for LDAP interaction.
31
+     * @param string $uid
32
+     * @return Access instance of Access for LDAP interaction
33
+     */
34
+    public function getLDAPAccess($uid);
35 35
 	
36
-	/**
37
-	 * Return a new LDAP connection for the specified user.
38
-	 * @param string $uid
39
-	 * @return resource of the LDAP connection
40
-	 */
41
-	public function getNewLDAPConnection($uid);
36
+    /**
37
+     * Return a new LDAP connection for the specified user.
38
+     * @param string $uid
39
+     * @return resource of the LDAP connection
40
+     */
41
+    public function getNewLDAPConnection($uid);
42 42
 
43
-	/**
44
-	 * Return the username for the given LDAP DN, if available.
45
-	 * @param string $dn
46
-	 * @return string|false with the username
47
-	 */
48
-	public function dn2UserName($dn);
43
+    /**
44
+     * Return the username for the given LDAP DN, if available.
45
+     * @param string $dn
46
+     * @return string|false with the username
47
+     */
48
+    public function dn2UserName($dn);
49 49
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/LDAPUtility.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 namespace OCA\User_LDAP;
27 27
 
28 28
 abstract class LDAPUtility {
29
-	protected $ldap;
29
+    protected $ldap;
30 30
 
31
-	/**
32
-	 * constructor, make sure the subclasses call this one!
33
-	 * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper
34
-	 */
35
-	public function __construct(ILDAPWrapper $ldapWrapper) {
36
-		$this->ldap = $ldapWrapper;
37
-	}
31
+    /**
32
+     * constructor, make sure the subclasses call this one!
33
+     * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper
34
+     */
35
+    public function __construct(ILDAPWrapper $ldapWrapper) {
36
+        $this->ldap = $ldapWrapper;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
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
@@ -27,37 +27,37 @@
 block discarded – undo
27 27
  *
28 28
  */
29 29
 $this->create('user_ldap_ajax_clearMappings', 'apps/user_ldap/ajax/clearMappings.php')
30
-	->actionInclude('user_ldap/ajax/clearMappings.php');
30
+    ->actionInclude('user_ldap/ajax/clearMappings.php');
31 31
 $this->create('user_ldap_ajax_deleteConfiguration', 'apps/user_ldap/ajax/deleteConfiguration.php')
32
-	->actionInclude('user_ldap/ajax/deleteConfiguration.php');
32
+    ->actionInclude('user_ldap/ajax/deleteConfiguration.php');
33 33
 $this->create('user_ldap_ajax_getConfiguration', 'apps/user_ldap/ajax/getConfiguration.php')
34
-	->actionInclude('user_ldap/ajax/getConfiguration.php');
34
+    ->actionInclude('user_ldap/ajax/getConfiguration.php');
35 35
 $this->create('user_ldap_ajax_getNewServerConfigPrefix', 'apps/user_ldap/ajax/getNewServerConfigPrefix.php')
36
-	->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php');
36
+    ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php');
37 37
 $this->create('user_ldap_ajax_setConfiguration', 'apps/user_ldap/ajax/setConfiguration.php')
38
-	->actionInclude('user_ldap/ajax/setConfiguration.php');
38
+    ->actionInclude('user_ldap/ajax/setConfiguration.php');
39 39
 $this->create('user_ldap_ajax_testConfiguration', 'apps/user_ldap/ajax/testConfiguration.php')
40
-	->actionInclude('user_ldap/ajax/testConfiguration.php');
40
+    ->actionInclude('user_ldap/ajax/testConfiguration.php');
41 41
 $this->create('user_ldap_ajax_wizard', 'apps/user_ldap/ajax/wizard.php')
42
-	->actionInclude('user_ldap/ajax/wizard.php');
42
+    ->actionInclude('user_ldap/ajax/wizard.php');
43 43
 
44 44
 $application = new \OCP\AppFramework\App('user_ldap');
45 45
 $application->registerRoutes($this, [
46
-	'ocs' => [
47
-		['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
48
-		['name' => 'ConfigAPI#show',   'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
49
-		['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
50
-		['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
51
-	]
46
+    'ocs' => [
47
+        ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
48
+        ['name' => 'ConfigAPI#show',   'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
49
+        ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
50
+        ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
51
+    ]
52 52
 ]);
53 53
 
54 54
 /** @var \OCA\User_LDAP\AppInfo\Application $application */
55 55
 $application = \OC::$server->query(\OCA\User_LDAP\AppInfo\Application::class);
56 56
 $application->registerRoutes($this, [
57
-	'routes' => [
58
-		['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
59
-		['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'],
60
-		['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'],
61
-		['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'],
62
-	]
57
+    'routes' => [
58
+        ['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
59
+        ['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'],
60
+        ['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'],
61
+        ['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'],
62
+    ]
63 63
 ]);
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/GlobalStoragesService.php 2 patches
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.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -36,151 +36,151 @@
 block discarded – undo
36 36
  * Service class to manage global external storage
37 37
  */
38 38
 class GlobalStoragesService extends StoragesService {
39
-	/**
40
-	 * Triggers $signal for all applicable users of the given
41
-	 * storage
42
-	 *
43
-	 * @param StorageConfig $storage storage data
44
-	 * @param string $signal signal to trigger
45
-	 */
46
-	protected function triggerHooks(StorageConfig $storage, $signal) {
47
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
48
-		$applicableUsers = $storage->getApplicableUsers();
49
-		$applicableGroups = $storage->getApplicableGroups();
50
-		if (empty($applicableUsers) && empty($applicableGroups)) {
51
-			// raise for user "all"
52
-			$this->triggerApplicableHooks(
53
-				$signal,
54
-				$storage->getMountPoint(),
55
-				\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
56
-				['all']
57
-			);
58
-			return;
59
-		}
60
-
61
-		$this->triggerApplicableHooks(
62
-			$signal,
63
-			$storage->getMountPoint(),
64
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
65
-			$applicableUsers
66
-		);
67
-		$this->triggerApplicableHooks(
68
-			$signal,
69
-			$storage->getMountPoint(),
70
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
71
-			$applicableGroups
72
-		);
73
-	}
74
-
75
-	/**
76
-	 * Triggers signal_create_mount or signal_delete_mount to
77
-	 * accommodate for additions/deletions in applicableUsers
78
-	 * and applicableGroups fields.
79
-	 *
80
-	 * @param StorageConfig $oldStorage old storage config
81
-	 * @param StorageConfig $newStorage new storage config
82
-	 */
83
-	protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) {
84
-		// if mount point changed, it's like a deletion + creation
85
-		if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) {
86
-			$this->triggerHooks($oldStorage, Filesystem::signal_delete_mount);
87
-			$this->triggerHooks($newStorage, Filesystem::signal_create_mount);
88
-			return;
89
-		}
90
-
91
-		$userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers());
92
-		$userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers());
93
-		$groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups());
94
-		$groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups());
95
-
96
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
97
-		// if no applicable were set, raise a signal for "all"
98
-		$oldApplicableUsers = $oldStorage->getApplicableUsers();
99
-		$oldApplicableGroups = $oldStorage->getApplicableGroups();
100
-		if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) {
101
-			$this->triggerApplicableHooks(
102
-				Filesystem::signal_delete_mount,
103
-				$oldStorage->getMountPoint(),
104
-				\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
105
-				['all']
106
-			);
107
-		}
108
-
109
-		// trigger delete for removed users
110
-		$this->triggerApplicableHooks(
111
-			Filesystem::signal_delete_mount,
112
-			$oldStorage->getMountPoint(),
113
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
114
-			$userDeletions
115
-		);
116
-
117
-		// trigger delete for removed groups
118
-		$this->triggerApplicableHooks(
119
-			Filesystem::signal_delete_mount,
120
-			$oldStorage->getMountPoint(),
121
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
122
-			$groupDeletions
123
-		);
124
-
125
-		// and now add the new users
126
-		$this->triggerApplicableHooks(
127
-			Filesystem::signal_create_mount,
128
-			$newStorage->getMountPoint(),
129
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
130
-			$userAdditions
131
-		);
132
-
133
-		// and now add the new groups
134
-		$this->triggerApplicableHooks(
135
-			Filesystem::signal_create_mount,
136
-			$newStorage->getMountPoint(),
137
-			\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
138
-			$groupAdditions
139
-		);
140
-
141
-		// FIXME: Use as expression in empty once PHP 5.4 support is dropped
142
-		// if no applicable, raise a signal for "all"
143
-		$newApplicableUsers = $newStorage->getApplicableUsers();
144
-		$newApplicableGroups = $newStorage->getApplicableGroups();
145
-		if (empty($newApplicableUsers) && empty($newApplicableGroups)) {
146
-			$this->triggerApplicableHooks(
147
-				Filesystem::signal_create_mount,
148
-				$newStorage->getMountPoint(),
149
-				\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
150
-				['all']
151
-			);
152
-		}
153
-	}
154
-
155
-	/**
156
-	 * Get the visibility type for this controller, used in validation
157
-	 *
158
-	 * @return string BackendService::VISIBILITY_* constants
159
-	 */
160
-	public function getVisibilityType() {
161
-		return BackendService::VISIBILITY_ADMIN;
162
-	}
163
-
164
-	protected function isApplicable(StorageConfig $config) {
165
-		return true;
166
-	}
167
-
168
-	/**
169
-	 * Get all configured admin and personal mounts
170
-	 *
171
-	 * @return StorageConfig[] map of storage id to storage config
172
-	 */
173
-	public function getStorageForAllUsers() {
174
-		$mounts = $this->dbConfig->getAllMounts();
175
-		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
176
-		$configs = array_filter($configs, function ($config) {
177
-			return $config instanceof StorageConfig;
178
-		});
179
-
180
-		$keys = array_map(function (StorageConfig $config) {
181
-			return $config->getId();
182
-		}, $configs);
183
-
184
-		return array_combine($keys, $configs);
185
-	}
39
+    /**
40
+     * Triggers $signal for all applicable users of the given
41
+     * storage
42
+     *
43
+     * @param StorageConfig $storage storage data
44
+     * @param string $signal signal to trigger
45
+     */
46
+    protected function triggerHooks(StorageConfig $storage, $signal) {
47
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
48
+        $applicableUsers = $storage->getApplicableUsers();
49
+        $applicableGroups = $storage->getApplicableGroups();
50
+        if (empty($applicableUsers) && empty($applicableGroups)) {
51
+            // raise for user "all"
52
+            $this->triggerApplicableHooks(
53
+                $signal,
54
+                $storage->getMountPoint(),
55
+                \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
56
+                ['all']
57
+            );
58
+            return;
59
+        }
60
+
61
+        $this->triggerApplicableHooks(
62
+            $signal,
63
+            $storage->getMountPoint(),
64
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
65
+            $applicableUsers
66
+        );
67
+        $this->triggerApplicableHooks(
68
+            $signal,
69
+            $storage->getMountPoint(),
70
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
71
+            $applicableGroups
72
+        );
73
+    }
74
+
75
+    /**
76
+     * Triggers signal_create_mount or signal_delete_mount to
77
+     * accommodate for additions/deletions in applicableUsers
78
+     * and applicableGroups fields.
79
+     *
80
+     * @param StorageConfig $oldStorage old storage config
81
+     * @param StorageConfig $newStorage new storage config
82
+     */
83
+    protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) {
84
+        // if mount point changed, it's like a deletion + creation
85
+        if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) {
86
+            $this->triggerHooks($oldStorage, Filesystem::signal_delete_mount);
87
+            $this->triggerHooks($newStorage, Filesystem::signal_create_mount);
88
+            return;
89
+        }
90
+
91
+        $userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers());
92
+        $userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers());
93
+        $groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups());
94
+        $groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups());
95
+
96
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
97
+        // if no applicable were set, raise a signal for "all"
98
+        $oldApplicableUsers = $oldStorage->getApplicableUsers();
99
+        $oldApplicableGroups = $oldStorage->getApplicableGroups();
100
+        if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) {
101
+            $this->triggerApplicableHooks(
102
+                Filesystem::signal_delete_mount,
103
+                $oldStorage->getMountPoint(),
104
+                \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
105
+                ['all']
106
+            );
107
+        }
108
+
109
+        // trigger delete for removed users
110
+        $this->triggerApplicableHooks(
111
+            Filesystem::signal_delete_mount,
112
+            $oldStorage->getMountPoint(),
113
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
114
+            $userDeletions
115
+        );
116
+
117
+        // trigger delete for removed groups
118
+        $this->triggerApplicableHooks(
119
+            Filesystem::signal_delete_mount,
120
+            $oldStorage->getMountPoint(),
121
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
122
+            $groupDeletions
123
+        );
124
+
125
+        // and now add the new users
126
+        $this->triggerApplicableHooks(
127
+            Filesystem::signal_create_mount,
128
+            $newStorage->getMountPoint(),
129
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
130
+            $userAdditions
131
+        );
132
+
133
+        // and now add the new groups
134
+        $this->triggerApplicableHooks(
135
+            Filesystem::signal_create_mount,
136
+            $newStorage->getMountPoint(),
137
+            \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
138
+            $groupAdditions
139
+        );
140
+
141
+        // FIXME: Use as expression in empty once PHP 5.4 support is dropped
142
+        // if no applicable, raise a signal for "all"
143
+        $newApplicableUsers = $newStorage->getApplicableUsers();
144
+        $newApplicableGroups = $newStorage->getApplicableGroups();
145
+        if (empty($newApplicableUsers) && empty($newApplicableGroups)) {
146
+            $this->triggerApplicableHooks(
147
+                Filesystem::signal_create_mount,
148
+                $newStorage->getMountPoint(),
149
+                \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
150
+                ['all']
151
+            );
152
+        }
153
+    }
154
+
155
+    /**
156
+     * Get the visibility type for this controller, used in validation
157
+     *
158
+     * @return string BackendService::VISIBILITY_* constants
159
+     */
160
+    public function getVisibilityType() {
161
+        return BackendService::VISIBILITY_ADMIN;
162
+    }
163
+
164
+    protected function isApplicable(StorageConfig $config) {
165
+        return true;
166
+    }
167
+
168
+    /**
169
+     * Get all configured admin and personal mounts
170
+     *
171
+     * @return StorageConfig[] map of storage id to storage config
172
+     */
173
+    public function getStorageForAllUsers() {
174
+        $mounts = $this->dbConfig->getAllMounts();
175
+        $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
176
+        $configs = array_filter($configs, function ($config) {
177
+            return $config instanceof StorageConfig;
178
+        });
179
+
180
+        $keys = array_map(function (StorageConfig $config) {
181
+            return $config->getId();
182
+        }, $configs);
183
+
184
+        return array_combine($keys, $configs);
185
+    }
186 186
 }
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.
apps/files_external/lib/Command/Option.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -28,50 +28,50 @@
 block discarded – undo
28 28
 use Symfony\Component\Console\Output\OutputInterface;
29 29
 
30 30
 class Option extends Config {
31
-	protected function configure() {
32
-		$this
33
-			->setName('files_external:option')
34
-			->setDescription('Manage mount options for a mount')
35
-			->addArgument(
36
-				'mount_id',
37
-				InputArgument::REQUIRED,
38
-				'The id of the mount to edit'
39
-			)->addArgument(
40
-				'key',
41
-				InputArgument::REQUIRED,
42
-				'key of the mount option to set/get'
43
-			)->addArgument(
44
-				'value',
45
-				InputArgument::OPTIONAL,
46
-				'value to set the mount option to, when no value is provided the existing value will be printed'
47
-			);
48
-	}
31
+    protected function configure() {
32
+        $this
33
+            ->setName('files_external:option')
34
+            ->setDescription('Manage mount options for a mount')
35
+            ->addArgument(
36
+                'mount_id',
37
+                InputArgument::REQUIRED,
38
+                'The id of the mount to edit'
39
+            )->addArgument(
40
+                'key',
41
+                InputArgument::REQUIRED,
42
+                'key of the mount option to set/get'
43
+            )->addArgument(
44
+                'value',
45
+                InputArgument::OPTIONAL,
46
+                'value to set the mount option to, when no value is provided the existing value will be printed'
47
+            );
48
+    }
49 49
 
50
-	/**
51
-	 * @param StorageConfig $mount
52
-	 * @param string $key
53
-	 * @param OutputInterface $output
54
-	 */
55
-	protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
56
-		$value = $mount->getMountOption($key);
57
-		if (!is_string($value)) { // show bools and objects correctly
58
-			$value = json_encode($value);
59
-		}
60
-		$output->writeln($value);
61
-	}
50
+    /**
51
+     * @param StorageConfig $mount
52
+     * @param string $key
53
+     * @param OutputInterface $output
54
+     */
55
+    protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
56
+        $value = $mount->getMountOption($key);
57
+        if (!is_string($value)) { // show bools and objects correctly
58
+            $value = json_encode($value);
59
+        }
60
+        $output->writeln($value);
61
+    }
62 62
 
63
-	/**
64
-	 * @param StorageConfig $mount
65
-	 * @param string $key
66
-	 * @param string $value
67
-	 * @param OutputInterface $output
68
-	 */
69
-	protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
70
-		$decoded = json_decode($value, true);
71
-		if (!is_null($decoded)) {
72
-			$value = $decoded;
73
-		}
74
-		$mount->setMountOption($key, $value);
75
-		$this->globalService->updateStorage($mount);
76
-	}
63
+    /**
64
+     * @param StorageConfig $mount
65
+     * @param string $key
66
+     * @param string $value
67
+     * @param OutputInterface $output
68
+     */
69
+    protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
70
+        $decoded = json_decode($value, true);
71
+        if (!is_null($decoded)) {
72
+            $value = $decoded;
73
+        }
74
+        $mount->setMountOption($key, $value);
75
+        $this->globalService->updateStorage($mount);
76
+    }
77 77
 }
Please login to merge, or discard this patch.