@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
| 5 | 5 | * |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // Admin? Or SubAdmin? |
| 127 | 127 | $uid = $user->getUID(); |
| 128 | 128 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 129 | - if ($this->groupManager->isAdmin($uid)){ |
|
| 129 | + if ($this->groupManager->isAdmin($uid)) { |
|
| 130 | 130 | $users = $this->userManager->search($search, $limit, $offset); |
| 131 | 131 | } else if ($subAdminManager->isSubAdmin($user)) { |
| 132 | 132 | $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | // Admin? Or SubAdmin? |
| 160 | 160 | $uid = $user->getUID(); |
| 161 | 161 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 162 | - if ($this->groupManager->isAdmin($uid)){ |
|
| 162 | + if ($this->groupManager->isAdmin($uid)) { |
|
| 163 | 163 | $users = $this->userManager->search($search, $limit, $offset); |
| 164 | 164 | } else if ($subAdminManager->isSubAdmin($user)) { |
| 165 | 165 | $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | throw new OCSException('group '.$group.' does not exist', 104); |
| 223 | 223 | } |
| 224 | 224 | if (!$isAdmin && !$subAdminManager->isSubAdminOfGroup($user, $this->groupManager->get($group))) { |
| 225 | - throw new OCSException('insufficient privileges for group '. $group, 105); |
|
| 225 | + throw new OCSException('insufficient privileges for group '.$group, 105); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } else { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $group = $this->groupManager->get($groupid); |
| 238 | 238 | // Check if group exists |
| 239 | 239 | if ($group === null) { |
| 240 | - throw new OCSException('Subadmin group does not exist', 102); |
|
| 240 | + throw new OCSException('Subadmin group does not exist', 102); |
|
| 241 | 241 | } |
| 242 | 242 | // Check if trying to make subadmin of admin group |
| 243 | 243 | if ($group->getGID() === 'admin') { |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | try { |
| 267 | 267 | $newUser = $this->userManager->createUser($userid, $password); |
| 268 | - $this->logger->info('Successful addUser call with userid: ' . $userid, ['app' => 'ocs_api']); |
|
| 268 | + $this->logger->info('Successful addUser call with userid: '.$userid, ['app' => 'ocs_api']); |
|
| 269 | 269 | |
| 270 | 270 | foreach ($groups as $group) { |
| 271 | 271 | $this->groupManager->get($group)->addUser($newUser); |
| 272 | - $this->logger->info('Added userid ' . $userid . ' to group ' . $group, ['app' => 'ocs_api']); |
|
| 272 | + $this->logger->info('Added userid '.$userid.' to group '.$group, ['app' => 'ocs_api']); |
|
| 273 | 273 | } |
| 274 | 274 | foreach ($subadminGroups as $group) { |
| 275 | 275 | $subAdminManager->createSubAdmin($newUser, $group); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | return new DataResponse(); |
| 299 | 299 | |
| 300 | - } catch (HintException $e ) { |
|
| 300 | + } catch (HintException $e) { |
|
| 301 | 301 | $this->logger->logException($e, [ |
| 302 | 302 | 'message' => 'Failed addUser attempt with hint exception.', |
| 303 | 303 | 'level' => \OCP\Util::WARN, |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | public function getCurrentUser(): DataResponse { |
| 346 | 346 | $user = $this->userSession->getUser(); |
| 347 | 347 | if ($user) { |
| 348 | - $data = $this->getUserData($user->getUID()); |
|
| 348 | + $data = $this->getUserData($user->getUID()); |
|
| 349 | 349 | // rename "displayname" to "display-name" only for this call to keep |
| 350 | 350 | // the API stable. |
| 351 | 351 | $data['display-name'] = $data['displayname']; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 462 | 462 | } |
| 463 | 463 | // Process the edit |
| 464 | - switch($key) { |
|
| 464 | + switch ($key) { |
|
| 465 | 465 | case 'display': |
| 466 | 466 | case AccountManager::PROPERTY_DISPLAYNAME: |
| 467 | 467 | $targetUser->setDisplayName($value); |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | if ($quota === 0) { |
| 481 | 481 | $quota = 'default'; |
| 482 | - }else if ($quota === -1) { |
|
| 482 | + } else if ($quota === -1) { |
|
| 483 | 483 | $quota = 'none'; |
| 484 | 484 | } else { |
| 485 | 485 | $quota = \OCP\Util::humanFileSize($quota); |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | } else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) { |
| 729 | 729 | /** @var IGroup[] $subAdminGroups */ |
| 730 | 730 | $subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser); |
| 731 | - $subAdminGroups = array_map(function (IGroup $subAdminGroup) { |
|
| 731 | + $subAdminGroups = array_map(function(IGroup $subAdminGroup) { |
|
| 732 | 732 | return $subAdminGroup->getGID(); |
| 733 | 733 | }, $subAdminGroups); |
| 734 | 734 | $userGroups = $this->groupManager->getUserGroupIds($targetUser); |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | } |
| 766 | 766 | // Check if group exists |
| 767 | 767 | if ($group === null) { |
| 768 | - throw new OCSException('Group does not exist', 102); |
|
| 768 | + throw new OCSException('Group does not exist', 102); |
|
| 769 | 769 | } |
| 770 | 770 | // Check if trying to make subadmin of admin group |
| 771 | 771 | if ($group->getGID() === 'admin') { |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | $this->newUserMailHelper->setL10N($l10n); |
| 877 | 877 | $emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false); |
| 878 | 878 | $this->newUserMailHelper->sendMail($targetUser, $emailTemplate); |
| 879 | - } catch(\Exception $e) { |
|
| 879 | + } catch (\Exception $e) { |
|
| 880 | 880 | $this->logger->logException($e, [ |
| 881 | 881 | 'message' => "Can't send new user mail to $email", |
| 882 | 882 | 'level' => \OCP\Util::ERROR, |