summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/GroupsController.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/provisioning_api/lib/Controller/GroupsController.php
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-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/GroupsController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 435f0410217..7f2da88a097 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -163,7 +163,7 @@ class GroupsController extends AUserData {
}
// Check subadmin has access to this group
- if($this->groupManager->isAdmin($user->getUID())
+ if ($this->groupManager->isAdmin($user->getUID())
|| $isSubadminOfGroup) {
$users = $this->groupManager->get($groupId)->getUsers();
$users = array_map(function ($user) {
@@ -201,7 +201,7 @@ class GroupsController extends AUserData {
}
// Check subadmin has access to this group
- if($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) {
+ if ($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) {
$users = $group->searchUsers($search, $limit, $offset);
// Extract required number
@@ -219,7 +219,7 @@ class GroupsController extends AUserData {
// only showing its id
$usersDetails[$userId] = ['id' => $userId];
}
- } catch(OCSNotFoundException $e) {
+ } catch (OCSNotFoundException $e) {
// continue if a users ceased to exist.
}
}
@@ -240,12 +240,12 @@ class GroupsController extends AUserData {
*/
public function addGroup(string $groupid): DataResponse {
// Validate name
- if(empty($groupid)) {
+ if (empty($groupid)) {
$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
throw new OCSException('Invalid group name', 101);
}
// Check if it exists
- if($this->groupManager->groupExists($groupid)){
+ if ($this->groupManager->groupExists($groupid)) {
throw new OCSException('group exists', 102);
}
$this->groupManager->createGroup($groupid);
@@ -283,9 +283,9 @@ class GroupsController extends AUserData {
*/
public function deleteGroup(string $groupId): DataResponse {
// Check it exists
- if(!$this->groupManager->groupExists($groupId)){
+ if (!$this->groupManager->groupExists($groupId)) {
throw new OCSException('', 101);
- } elseif($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){
+ } elseif ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) {
// Cannot delete admin group
throw new OCSException('', 102);
}
@@ -301,7 +301,7 @@ class GroupsController extends AUserData {
public function getSubAdminsOfGroup(string $groupId): DataResponse {
// Check group exists
$targetGroup = $this->groupManager->get($groupId);
- if($targetGroup === null) {
+ if ($targetGroup === null) {
throw new OCSException('Group does not exist', 101);
}
@@ -315,5 +315,4 @@ class GroupsController extends AUserData {
return new DataResponse($uids);
}
-
}