Completed
Push — master ( 60adc9...6b6c43 )
by Julius
26:34
created
apps/provisioning_api/lib/Controller/GroupsController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 		// Check the group exists
152 152
 		$group = $this->groupManager->get($groupId);
153 153
 		if ($group !== null) {
154
-			$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
154
+			$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
155 155
 		} else {
156 156
 			throw new OCSNotFoundException('The requested group could not be found');
157 157
 		}
158 158
 
159 159
 		// Check subadmin has access to this group
160
-		if($this->groupManager->isAdmin($user->getUID())
160
+		if ($this->groupManager->isAdmin($user->getUID())
161 161
 		   || $isSubadminOfGroup) {
162 162
 			$users = $this->groupManager->get($groupId)->getUsers();
163
-			$users =  array_map(function($user) {
163
+			$users = array_map(function($user) {
164 164
 				/** @var IUser $user */
165 165
 				return $user->getUID();
166 166
 			}, $users);
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 		// Check the group exists
191 191
 		$group = $this->groupManager->get($groupId);
192 192
 		if ($group !== null) {
193
-			$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
193
+			$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
194 194
 		} else {
195 195
 			throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
196 196
 		}
197 197
 
198 198
 		// Check subadmin has access to this group
199
-		if($this->groupManager->isAdmin($user->getUID())
199
+		if ($this->groupManager->isAdmin($user->getUID())
200 200
 		   || $isSubadminOfGroup) {
201 201
 			$users = $this->groupManager->get($groupId)->searchUsers($search, $limit, $offset);
202 202
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			foreach ($users as $userId) {
207 207
 				$userData = $this->getUserData($userId);
208 208
 				// Do not insert empty entry
209
-				if(!empty($userData)) {
209
+				if (!empty($userData)) {
210 210
 					$usersDetails[$userId] = $userData;
211 211
 				} else {
212 212
 					// Logged user does not have permissions to see this user
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function addGroup(string $groupid): DataResponse {
233 233
 		// Validate name
234
-		if(empty($groupid)) {
234
+		if (empty($groupid)) {
235 235
 			$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
236 236
 			throw new OCSException('Invalid group name', 101);
237 237
 		}
238 238
 		// Check if it exists
239
-		if($this->groupManager->groupExists($groupid)){
239
+		if ($this->groupManager->groupExists($groupid)) {
240 240
 			throw new OCSException('', 102);
241 241
 		}
242 242
 		$this->groupManager->createGroup($groupid);
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function deleteGroup(string $groupId): DataResponse {
254 254
 		// Check it exists
255
-		if(!$this->groupManager->groupExists($groupId)){
255
+		if (!$this->groupManager->groupExists($groupId)) {
256 256
 			throw new OCSException('', 101);
257
-		} else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){
257
+		} else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) {
258 258
 			// Cannot delete admin group
259 259
 			throw new OCSException('', 102);
260 260
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	public function getSubAdminsOfGroup(string $groupId): DataResponse {
271 271
 		// Check group exists
272 272
 		$targetGroup = $this->groupManager->get($groupId);
273
-		if($targetGroup === null) {
273
+		if ($targetGroup === null) {
274 274
 			throw new OCSException('Group does not exist', 101);
275 275
 		}
276 276
 
Please login to merge, or discard this patch.