diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/provisioning_api/lib/Controller/UsersController.php | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/provisioning_api/lib/Controller/UsersController.php')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index ff67a880c13..bd327ffe441 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -140,7 +140,7 @@ class UsersController extends AUserData { // Admin? Or SubAdmin? $uid = $user->getUID(); $subAdminManager = $this->groupManager->getSubAdmin(); - if ($this->groupManager->isAdmin($uid)){ + if ($this->groupManager->isAdmin($uid)) { $users = $this->userManager->search($search, $limit, $offset); } elseif ($subAdminManager->isSubAdmin($user)) { $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user); @@ -173,7 +173,7 @@ class UsersController extends AUserData { // Admin? Or SubAdmin? $uid = $currentUser->getUID(); $subAdminManager = $this->groupManager->getSubAdmin(); - if ($this->groupManager->isAdmin($uid)){ + if ($this->groupManager->isAdmin($uid)) { $users = $this->userManager->search($search, $limit, $offset); $users = array_keys($users); } elseif ($subAdminManager->isSubAdmin($currentUser)) { @@ -250,7 +250,7 @@ class UsersController extends AUserData { $isAdmin = $this->groupManager->isAdmin($user->getUID()); $subAdminManager = $this->groupManager->getSubAdmin(); - if(empty($userid) && $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes') { + if (empty($userid) && $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes') { $userid = $this->createNewUserId(); } @@ -352,7 +352,6 @@ class UsersController extends AUserData { } return new DataResponse(['id' => $userid]); - } catch (HintException $e) { $this->logger->logException($e, [ 'message' => 'Failed addUser attempt with hint exception.', @@ -414,7 +413,6 @@ class UsersController extends AUserData { $data['display-name'] = $data['displayname']; unset($data['displayname']); return new DataResponse($data); - } throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); @@ -530,7 +528,7 @@ class UsersController extends AUserData { throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); } // Process the edit - switch($key) { + switch ($key) { case 'display': case AccountManager::PROPERTY_DISPLAYNAME: $targetUser->setDisplayName($value); @@ -755,7 +753,6 @@ class UsersController extends AUserData { throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); } } - } /** @@ -835,7 +832,6 @@ class UsersController extends AUserData { // Not an admin, so the user must be a subadmin of this group, but that is not allowed. throw new OCSException('Cannot remove yourself from this group as you are a SubAdmin', 105); } - } elseif (!$this->groupManager->isAdmin($loggedInUser->getUID())) { /** @var IGroup[] $subAdminGroups */ $subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser); @@ -973,7 +969,7 @@ class UsersController extends AUserData { try { $emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false); $this->newUserMailHelper->sendMail($targetUser, $emailTemplate); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->logger->logException($e, [ 'message' => "Can't send new user mail to $email", 'level' => ILogger::ERROR, |