Completed
Push — master ( 5aaa8a...afaee6 )
by Morris
12:26
created
apps/provisioning_api/lib/Controller/UsersController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		// Admin? Or SubAdmin?
129 129
 		$uid = $user->getUID();
130 130
 		$subAdminManager = $this->groupManager->getSubAdmin();
131
-		if ($this->groupManager->isAdmin($uid)){
131
+		if ($this->groupManager->isAdmin($uid)) {
132 132
 			$users = $this->userManager->search($search, $limit, $offset);
133 133
 		} else if ($subAdminManager->isSubAdmin($user)) {
134 134
 			$subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		// Admin? Or SubAdmin?
162 162
 		$uid = $currentUser->getUID();
163 163
 		$subAdminManager = $this->groupManager->getSubAdmin();
164
-		if ($this->groupManager->isAdmin($uid)){
164
+		if ($this->groupManager->isAdmin($uid)) {
165 165
 			$users = $this->userManager->search($search, $limit, $offset);
166 166
 			$users = array_keys($users);
167 167
 		} else if ($subAdminManager->isSubAdmin($currentUser)) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 					throw new OCSException('group '.$group.' does not exist', 104);
235 235
 				}
236 236
 				if (!$isAdmin && !$subAdminManager->isSubAdminOfGroup($user, $this->groupManager->get($group))) {
237
-					throw new OCSException('insufficient privileges for group '. $group, 105);
237
+					throw new OCSException('insufficient privileges for group '.$group, 105);
238 238
 				}
239 239
 			}
240 240
 		} else {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 				$group = $this->groupManager->get($groupid);
250 250
 				// Check if group exists
251 251
 				if ($group === null) {
252
-					throw new OCSException('Subadmin group does not exist',  102);
252
+					throw new OCSException('Subadmin group does not exist', 102);
253 253
 				}
254 254
 				// Check if trying to make subadmin of admin group
255 255
 				if ($group->getGID() === 'admin') {
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 
278 278
 		try {
279 279
 			$newUser = $this->userManager->createUser($userid, $password);
280
-			$this->logger->info('Successful addUser call with userid: ' . $userid, ['app' => 'ocs_api']);
280
+			$this->logger->info('Successful addUser call with userid: '.$userid, ['app' => 'ocs_api']);
281 281
 
282 282
 			foreach ($groups as $group) {
283 283
 				$this->groupManager->get($group)->addUser($newUser);
284
-				$this->logger->info('Added userid ' . $userid . ' to group ' . $group, ['app' => 'ocs_api']);
284
+				$this->logger->info('Added userid '.$userid.' to group '.$group, ['app' => 'ocs_api']);
285 285
 			}
286 286
 			foreach ($subadminGroups as $group) {
287 287
 				$subAdminManager->createSubAdmin($newUser, $group);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 			return new DataResponse();
319 319
 
320
-		} catch (HintException $e ) {
320
+		} catch (HintException $e) {
321 321
 			$this->logger->logException($e, [
322 322
 				'message' => 'Failed addUser attempt with hint exception.',
323 323
 				'level' => ILogger::WARN,
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	public function getCurrentUser(): DataResponse {
366 366
 		$user = $this->userSession->getUser();
367 367
 		if ($user) {
368
-			$data =  $this->getUserData($user->getUID());
368
+			$data = $this->getUserData($user->getUID());
369 369
 			// rename "displayname" to "display-name" only for this call to keep
370 370
 			// the API stable.
371 371
 			$data['display-name'] = $data['displayname'];
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
488 488
 		}
489 489
 		// Process the edit
490
-		switch($key) {
490
+		switch ($key) {
491 491
 			case 'display':
492 492
 			case AccountManager::PROPERTY_DISPLAYNAME:
493 493
 				$targetUser->setDisplayName($value);
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		} else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) {
759 759
 			/** @var IGroup[] $subAdminGroups */
760 760
 			$subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
761
-			$subAdminGroups = array_map(function (IGroup $subAdminGroup) {
761
+			$subAdminGroups = array_map(function(IGroup $subAdminGroup) {
762 762
 				return $subAdminGroup->getGID();
763 763
 			}, $subAdminGroups);
764 764
 			$userGroups = $this->groupManager->getUserGroupIds($targetUser);
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		}
796 796
 		// Check if group exists
797 797
 		if ($group === null) {
798
-			throw new OCSException('Group does not exist',  102);
798
+			throw new OCSException('Group does not exist', 102);
799 799
 		}
800 800
 		// Check if trying to make subadmin of admin group
801 801
 		if ($group->getGID() === 'admin') {
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 		try {
899 899
 			$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);
900 900
 			$this->newUserMailHelper->sendMail($targetUser, $emailTemplate);
901
-		} catch(\Exception $e) {
901
+		} catch (\Exception $e) {
902 902
 			$this->logger->logException($e, [
903 903
 				'message' => "Can't send new user mail to $email",
904 904
 				'level' => ILogger::ERROR,
Please login to merge, or discard this patch.