Completed
Pull Request — master (#10005)
by Robin
284:48 queued 266:04
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);
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 		// Check the group exists
193 193
 		$group = $this->groupManager->get($groupId);
194 194
 		if ($group !== null) {
195
-			$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
195
+			$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
196 196
 		} else {
197 197
 			throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
198 198
 		}
199 199
 
200 200
 		// Check subadmin has access to this group
201
-		if($this->groupManager->isAdmin($user->getUID())
201
+		if ($this->groupManager->isAdmin($user->getUID())
202 202
 		   || $isSubadminOfGroup) {
203 203
 			$users = $this->groupManager->get($groupId)->searchUsers($search, $limit, $offset);
204 204
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			foreach ($users as $userId) {
209 209
 				$userData = $this->getUserData($userId);
210 210
 				// Do not insert empty entry
211
-				if(!empty($userData)) {
211
+				if (!empty($userData)) {
212 212
 					$usersDetails[$userId] = $userData;
213 213
 				} else {
214 214
 					// Logged user does not have permissions to see this user
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function addGroup(string $groupid): DataResponse {
235 235
 		// Validate name
236
-		if(empty($groupid)) {
236
+		if (empty($groupid)) {
237 237
 			$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
238 238
 			throw new OCSException('Invalid group name', 101);
239 239
 		}
240 240
 		// Check if it exists
241
-		if($this->groupManager->groupExists($groupid)){
241
+		if ($this->groupManager->groupExists($groupid)) {
242 242
 			throw new OCSException('group exists', 102);
243 243
 		}
244 244
 		$this->groupManager->createGroup($groupid);
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function deleteGroup(string $groupId): DataResponse {
256 256
 		// Check it exists
257
-		if(!$this->groupManager->groupExists($groupId)){
257
+		if (!$this->groupManager->groupExists($groupId)) {
258 258
 			throw new OCSException('', 101);
259
-		} else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){
259
+		} else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) {
260 260
 			// Cannot delete admin group
261 261
 			throw new OCSException('', 102);
262 262
 		}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	public function getSubAdminsOfGroup(string $groupId): DataResponse {
273 273
 		// Check group exists
274 274
 		$targetGroup = $this->groupManager->get($groupId);
275
-		if($targetGroup === null) {
275
+		if ($targetGroup === null) {
276 276
 			throw new OCSException('Group does not exist', 101);
277 277
 		}
278 278
 
Please login to merge, or discard this patch.