Passed
Push — master ( 5fbf30...98244b )
by Roeland
14:00 queued 11s
created
apps/provisioning_api/lib/Controller/UsersController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		// Admin? Or SubAdmin?
128 128
 		$uid = $user->getUID();
129 129
 		$subAdminManager = $this->groupManager->getSubAdmin();
130
-		if ($this->groupManager->isAdmin($uid)){
130
+		if ($this->groupManager->isAdmin($uid)) {
131 131
 			$users = $this->userManager->search($search, $limit, $offset);
132 132
 		} else if ($subAdminManager->isSubAdmin($user)) {
133 133
 			$subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		// Admin? Or SubAdmin?
161 161
 		$uid = $currentUser->getUID();
162 162
 		$subAdminManager = $this->groupManager->getSubAdmin();
163
-		if ($this->groupManager->isAdmin($uid)){
163
+		if ($this->groupManager->isAdmin($uid)) {
164 164
 			$users = $this->userManager->search($search, $limit, $offset);
165 165
 			$users = array_keys($users);
166 166
 		} else if ($subAdminManager->isSubAdmin($currentUser)) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		$isAdmin = $this->groupManager->isAdmin($user->getUID());
238 238
 		$subAdminManager = $this->groupManager->getSubAdmin();
239 239
 
240
-		if(empty($userid) && $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes') {
240
+		if (empty($userid) && $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes') {
241 241
 			$userid = $this->createNewUserId();
242 242
 		}
243 243
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 					throw new OCSException('group '.$group.' does not exist', 104);
253 253
 				}
254 254
 				if (!$isAdmin && !$subAdminManager->isSubAdminOfGroup($user, $this->groupManager->get($group))) {
255
-					throw new OCSException('insufficient privileges for group '. $group, 105);
255
+					throw new OCSException('insufficient privileges for group '.$group, 105);
256 256
 				}
257 257
 			}
258 258
 		} else {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 				$group = $this->groupManager->get($groupid);
268 268
 				// Check if group exists
269 269
 				if ($group === null) {
270
-					throw new OCSException('Subadmin group does not exist',  102);
270
+					throw new OCSException('Subadmin group does not exist', 102);
271 271
 				}
272 272
 				// Check if trying to make subadmin of admin group
273 273
 				if ($group->getGID() === 'admin') {
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
 
300 300
 		try {
301 301
 			$newUser = $this->userManager->createUser($userid, $password);
302
-			$this->logger->info('Successful addUser call with userid: ' . $userid, ['app' => 'ocs_api']);
302
+			$this->logger->info('Successful addUser call with userid: '.$userid, ['app' => 'ocs_api']);
303 303
 
304 304
 			foreach ($groups as $group) {
305 305
 				$this->groupManager->get($group)->addUser($newUser);
306
-				$this->logger->info('Added userid ' . $userid . ' to group ' . $group, ['app' => 'ocs_api']);
306
+				$this->logger->info('Added userid '.$userid.' to group '.$group, ['app' => 'ocs_api']);
307 307
 			}
308 308
 			foreach ($subadminGroups as $group) {
309 309
 				$subAdminManager->createSubAdmin($newUser, $group);
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	public function getCurrentUser(): DataResponse {
395 395
 		$user = $this->userSession->getUser();
396 396
 		if ($user) {
397
-			$data =  $this->getUserData($user->getUID());
397
+			$data = $this->getUserData($user->getUID());
398 398
 			// rename "displayname" to "display-name" only for this call to keep
399 399
 			// the API stable.
400 400
 			$data['display-name'] = $data['displayname'];
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
517 517
 		}
518 518
 		// Process the edit
519
-		switch($key) {
519
+		switch ($key) {
520 520
 			case 'display':
521 521
 			case AccountManager::PROPERTY_DISPLAYNAME:
522 522
 				$targetUser->setDisplayName($value);
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		} else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) {
795 795
 			/** @var IGroup[] $subAdminGroups */
796 796
 			$subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
797
-			$subAdminGroups = array_map(function (IGroup $subAdminGroup) {
797
+			$subAdminGroups = array_map(function(IGroup $subAdminGroup) {
798 798
 				return $subAdminGroup->getGID();
799 799
 			}, $subAdminGroups);
800 800
 			$userGroups = $this->groupManager->getUserGroupIds($targetUser);
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 		}
832 832
 		// Check if group exists
833 833
 		if ($group === null) {
834
-			throw new OCSException('Group does not exist',  102);
834
+			throw new OCSException('Group does not exist', 102);
835 835
 		}
836 836
 		// Check if trying to make subadmin of admin group
837 837
 		if ($group->getGID() === 'admin') {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 		try {
929 929
 			$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);
930 930
 			$this->newUserMailHelper->sendMail($targetUser, $emailTemplate);
931
-		} catch(\Exception $e) {
931
+		} catch (\Exception $e) {
932 932
 			$this->logger->logException($e, [
933 933
 				'message' => "Can't send new user mail to $email",
934 934
 				'level' => ILogger::ERROR,
Please login to merge, or discard this patch.