Passed
Push — master ( 0a3df0...6cdb39 )
by Morris
13:13
created
apps/provisioning_api/lib/Controller/GroupsController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 		// Check the group exists
154 154
 		$group = $this->groupManager->get($groupId);
155 155
 		if ($group !== null) {
156
-			$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
156
+			$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
157 157
 		} else {
158 158
 			throw new OCSNotFoundException('The requested group could not be found');
159 159
 		}
160 160
 
161 161
 		// Check subadmin has access to this group
162
-		if($this->groupManager->isAdmin($user->getUID())
162
+		if ($this->groupManager->isAdmin($user->getUID())
163 163
 		   || $isSubadminOfGroup) {
164 164
 			$users = $this->groupManager->get($groupId)->getUsers();
165
-			$users =  array_map(function($user) {
165
+			$users = array_map(function($user) {
166 166
 				/** @var IUser $user */
167 167
 				return $user->getUID();
168 168
 			}, $users);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		}
198 198
 
199 199
 		// Check subadmin has access to this group
200
-		if($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) {
200
+		if ($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) {
201 201
 			$users = $group->searchUsers($search, $limit, $offset);
202 202
 
203 203
 			// Extract required number
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			foreach ($users as $user) {
206 206
 				try {
207 207
 					/** @var IUser $user */
208
-					$userId = (string)$user->getUID();
208
+					$userId = (string) $user->getUID();
209 209
 					$userData = $this->getUserData($userId);
210 210
 					// Do not insert empty entry
211 211
 					if (!empty($userData)) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 						// only showing its id
216 216
 						$usersDetails[$userId] = ['id' => $userId];
217 217
 					}
218
-				} catch(OCSNotFoundException $e) {
218
+				} catch (OCSNotFoundException $e) {
219 219
 					// continue if a users ceased to exist.
220 220
 				}
221 221
 			}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function addGroup(string $groupid): DataResponse {
238 238
 		// Validate name
239
-		if(empty($groupid)) {
239
+		if (empty($groupid)) {
240 240
 			$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
241 241
 			throw new OCSException('Invalid group name', 101);
242 242
 		}
243 243
 		// Check if it exists
244
-		if($this->groupManager->groupExists($groupid)){
244
+		if ($this->groupManager->groupExists($groupid)) {
245 245
 			throw new OCSException('group exists', 102);
246 246
 		}
247 247
 		$this->groupManager->createGroup($groupid);
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function deleteGroup(string $groupId): DataResponse {
259 259
 		// Check it exists
260
-		if(!$this->groupManager->groupExists($groupId)){
260
+		if (!$this->groupManager->groupExists($groupId)) {
261 261
 			throw new OCSException('', 101);
262
-		} else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){
262
+		} else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) {
263 263
 			// Cannot delete admin group
264 264
 			throw new OCSException('', 102);
265 265
 		}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	public function getSubAdminsOfGroup(string $groupId): DataResponse {
276 276
 		// Check group exists
277 277
 		$targetGroup = $this->groupManager->get($groupId);
278
-		if($targetGroup === null) {
278
+		if ($targetGroup === null) {
279 279
 			throw new OCSException('Group does not exist', 101);
280 280
 		}
281 281
 
Please login to merge, or discard this patch.