@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return string |
| 161 | 161 | */ |
| 162 | 162 | public function getId() { |
| 163 | - return 'shared::' . $this->getMountPoint(); |
|
| 163 | + return 'shared::'.$this->getMountPoint(); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | $info = array( |
| 259 | - 'target' => $this->getMountPoint() . $path, |
|
| 259 | + 'target' => $this->getMountPoint().$path, |
|
| 260 | 260 | 'source' => $source, |
| 261 | 261 | 'mode' => $mode, |
| 262 | 262 | ); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | public function file_get_contents($path) { |
| 459 | 459 | $info = [ |
| 460 | - 'target' => $this->getMountPoint() . '/' . $path, |
|
| 460 | + 'target' => $this->getMountPoint().'/'.$path, |
|
| 461 | 461 | 'source' => $this->getSourcePath($path), |
| 462 | 462 | ]; |
| 463 | 463 | \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info); |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | public function file_put_contents($path, $data) { |
| 468 | 468 | $info = [ |
| 469 | - 'target' => $this->getMountPoint() . '/' . $path, |
|
| 469 | + 'target' => $this->getMountPoint().'/'.$path, |
|
| 470 | 470 | 'source' => $this->getSourcePath($path), |
| 471 | 471 | ]; |
| 472 | 472 | \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info); |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | $shares = $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_USER, null, -1); |
| 72 | 72 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_GROUP, null, -1)); |
| 73 | 73 | // filter out excluded shares and group shares that includes self |
| 74 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
| 74 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
| 75 | 75 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function generateTarget($filePath, $shareWith, $exclude = null) { |
| 98 | 98 | $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); |
| 99 | - $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); |
|
| 99 | + $target = \OC\Files\Filesystem::normalizePath($shareFolder.'/'.basename($filePath)); |
|
| 100 | 100 | |
| 101 | 101 | // for group shares we return the target right away |
| 102 | 102 | if ($shareWith === false) { |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | \OC\Files\Filesystem::initMountPoints($shareWith); |
| 107 | - $view = new \OC\Files\View('/' . $shareWith . '/files'); |
|
| 107 | + $view = new \OC\Files\View('/'.$shareWith.'/files'); |
|
| 108 | 108 | |
| 109 | 109 | if (!$view->is_dir($shareFolder)) { |
| 110 | 110 | $dir = ''; |
| 111 | 111 | $subdirs = explode('/', $shareFolder); |
| 112 | 112 | foreach ($subdirs as $subdir) { |
| 113 | - $dir = $dir . '/' . $subdir; |
|
| 113 | + $dir = $dir.'/'.$subdir; |
|
| 114 | 114 | if (!$view->is_dir($dir)) { |
| 115 | 115 | $view->mkdir($dir); |
| 116 | 116 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | if ($share['item_type'] === 'folder' && $target !== '') { |
| 238 | 238 | // note: in case of ext storage mount points the path might be empty |
| 239 | 239 | // which would cause a leading slash to appear |
| 240 | - $share['path'] = ltrim($share['path'] . '/' . $target, '/'); |
|
| 240 | + $share['path'] = ltrim($share['path'].'/'.$target, '/'); |
|
| 241 | 241 | } |
| 242 | 242 | return self::resolveReshares($share); |
| 243 | 243 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $token = isset($_GET['t']) ? $_GET['t'] : ''; |
| 28 | 28 | $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare'; |
| 29 | 29 | |
| 30 | -if($token !== '') { |
|
| 30 | +if ($token !== '') { |
|
| 31 | 31 | OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token))); |
| 32 | 32 | } else { |
| 33 | 33 | header('HTTP/1.0 404 Not Found'); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | public function getApps($filter = null) { |
| 60 | 60 | $apps = (new OC_App())->listAllApps(); |
| 61 | 61 | $list = []; |
| 62 | - foreach($apps as $app) { |
|
| 62 | + foreach ($apps as $app) { |
|
| 63 | 63 | $list[] = $app['id']; |
| 64 | 64 | } |
| 65 | - if($filter){ |
|
| 66 | - switch($filter){ |
|
| 65 | + if ($filter) { |
|
| 66 | + switch ($filter) { |
|
| 67 | 67 | case 'enabled': |
| 68 | 68 | return new DataResponse(['apps' => \OC_App::getEnabledApps()]); |
| 69 | 69 | break; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function getAppInfo($app) { |
| 90 | 90 | $info = \OCP\App::getAppInfo($app); |
| 91 | - if(!is_null($info)) { |
|
| 91 | + if (!is_null($info)) { |
|
| 92 | 92 | return new DataResponse(OC_App::getAppInfo($app)); |
| 93 | 93 | } else { |
| 94 | 94 | throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // Admin? Or SubAdmin? |
| 105 | 105 | $uid = $user->getUID(); |
| 106 | 106 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 107 | - if($this->groupManager->isAdmin($uid)){ |
|
| 107 | + if ($this->groupManager->isAdmin($uid)) { |
|
| 108 | 108 | $users = $this->userManager->search($search, $limit, $offset); |
| 109 | 109 | } else if ($subAdminManager->isSubAdmin($user)) { |
| 110 | 110 | $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $subAdminOfGroups[$key] = $group->getGID(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if($offset === null) { |
|
| 115 | + if ($offset === null) { |
|
| 116 | 116 | $offset = 0; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -146,22 +146,22 @@ discard block |
||
| 146 | 146 | $isAdmin = $this->groupManager->isAdmin($user->getUID()); |
| 147 | 147 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 148 | 148 | |
| 149 | - if($this->userManager->userExists($userid)) { |
|
| 149 | + if ($this->userManager->userExists($userid)) { |
|
| 150 | 150 | $this->logger->error('Failed addUser attempt: User already exists.', ['app' => 'ocs_api']); |
| 151 | 151 | throw new OCSException('User already exists', 102); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(is_array($groups)) { |
|
| 154 | + if (is_array($groups)) { |
|
| 155 | 155 | foreach ($groups as $group) { |
| 156 | - if(!$this->groupManager->groupExists($group)) { |
|
| 156 | + if (!$this->groupManager->groupExists($group)) { |
|
| 157 | 157 | throw new OCSException('group '.$group.' does not exist', 104); |
| 158 | 158 | } |
| 159 | - if(!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) { |
|
| 160 | - throw new OCSException('insufficient privileges for group '. $group, 105); |
|
| 159 | + if (!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) { |
|
| 160 | + throw new OCSException('insufficient privileges for group '.$group, 105); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } else { |
| 164 | - if(!$isAdmin) { |
|
| 164 | + if (!$isAdmin) { |
|
| 165 | 165 | throw new OCSException('no group specified (required for subadmins)', 106); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | public function getCurrentUser() { |
| 211 | 211 | $user = $this->userSession->getUser(); |
| 212 | 212 | if ($user) { |
| 213 | - $data = $this->getUserData($user->getUID()); |
|
| 213 | + $data = $this->getUserData($user->getUID()); |
|
| 214 | 214 | // rename "displayname" to "display-name" only for this call to keep |
| 215 | 215 | // the API stable. |
| 216 | 216 | $data['display-name'] = $data['displayname']; |
@@ -236,17 +236,17 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Check if the target user exists |
| 238 | 238 | $targetUserObject = $this->userManager->get($userId); |
| 239 | - if($targetUserObject === null) { |
|
| 239 | + if ($targetUserObject === null) { |
|
| 240 | 240 | throw new OCSException('The requested user could not be found', \OCP\API::RESPOND_NOT_FOUND); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Admin? Or SubAdmin? |
| 244 | - if($this->groupManager->isAdmin($currentLoggedInUser->getUID()) |
|
| 244 | + if ($this->groupManager->isAdmin($currentLoggedInUser->getUID()) |
|
| 245 | 245 | || $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) { |
| 246 | 246 | $data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true'); |
| 247 | 247 | } else { |
| 248 | 248 | // Check they are looking up themselves |
| 249 | - if($currentLoggedInUser->getUID() !== $userId) { |
|
| 249 | + if ($currentLoggedInUser->getUID() !== $userId) { |
|
| 250 | 250 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -284,24 +284,24 @@ discard block |
||
| 284 | 284 | $currentLoggedInUser = $this->userSession->getUser(); |
| 285 | 285 | |
| 286 | 286 | $targetUser = $this->userManager->get($userId); |
| 287 | - if($targetUser === null) { |
|
| 287 | + if ($targetUser === null) { |
|
| 288 | 288 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | $permittedFields = []; |
| 292 | - if($userId === $currentLoggedInUser->getUID()) { |
|
| 292 | + if ($userId === $currentLoggedInUser->getUID()) { |
|
| 293 | 293 | // Editing self (display, email) |
| 294 | 294 | $permittedFields[] = 'display'; |
| 295 | 295 | $permittedFields[] = 'email'; |
| 296 | 296 | $permittedFields[] = 'password'; |
| 297 | 297 | // If admin they can edit their own quota |
| 298 | - if($this->groupManager->isAdmin($currentLoggedInUser->getUID())) { |
|
| 298 | + if ($this->groupManager->isAdmin($currentLoggedInUser->getUID())) { |
|
| 299 | 299 | $permittedFields[] = 'quota'; |
| 300 | 300 | } |
| 301 | 301 | } else { |
| 302 | 302 | // Check if admin / subadmin |
| 303 | 303 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 304 | - if($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser) |
|
| 304 | + if ($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser) |
|
| 305 | 305 | || $this->groupManager->isAdmin($currentLoggedInUser->getUID())) { |
| 306 | 306 | // They have permissions over the user |
| 307 | 307 | $permittedFields[] = 'display'; |
@@ -314,17 +314,17 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | // Check if permitted to edit this field |
| 317 | - if(!in_array($key, $permittedFields)) { |
|
| 317 | + if (!in_array($key, $permittedFields)) { |
|
| 318 | 318 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 319 | 319 | } |
| 320 | 320 | // Process the edit |
| 321 | - switch($key) { |
|
| 321 | + switch ($key) { |
|
| 322 | 322 | case 'display': |
| 323 | 323 | $targetUser->setDisplayName($value); |
| 324 | 324 | break; |
| 325 | 325 | case 'quota': |
| 326 | 326 | $quota = $value; |
| 327 | - if($quota !== 'none' && $quota !== 'default') { |
|
| 327 | + if ($quota !== 'none' && $quota !== 'default') { |
|
| 328 | 328 | if (is_numeric($quota)) { |
| 329 | 329 | $quota = (float) $quota; |
| 330 | 330 | } else { |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | if ($quota === false) { |
| 334 | 334 | throw new OCSException('Invalid quota value '.$value, 103); |
| 335 | 335 | } |
| 336 | - if($quota === 0) { |
|
| 336 | + if ($quota === 0) { |
|
| 337 | 337 | $quota = 'default'; |
| 338 | - }else if($quota === -1) { |
|
| 338 | + } else if ($quota === -1) { |
|
| 339 | 339 | $quota = 'none'; |
| 340 | 340 | } else { |
| 341 | 341 | $quota = \OCP\Util::humanFileSize($quota); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $targetUser->setPassword($value); |
| 348 | 348 | break; |
| 349 | 349 | case 'email': |
| 350 | - if(filter_var($value, FILTER_VALIDATE_EMAIL)) { |
|
| 350 | + if (filter_var($value, FILTER_VALIDATE_EMAIL)) { |
|
| 351 | 351 | $targetUser->setEMailAddress($value); |
| 352 | 352 | } else { |
| 353 | 353 | throw new OCSException('', 102); |
@@ -373,18 +373,18 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $targetUser = $this->userManager->get($userId); |
| 375 | 375 | |
| 376 | - if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) { |
|
| 376 | + if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) { |
|
| 377 | 377 | throw new OCSException('', 101); |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // If not permitted |
| 381 | 381 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 382 | - if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { |
|
| 382 | + if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { |
|
| 383 | 383 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | // Go ahead with the delete |
| 387 | - if($targetUser->delete()) { |
|
| 387 | + if ($targetUser->delete()) { |
|
| 388 | 388 | return new DataResponse(); |
| 389 | 389 | } else { |
| 390 | 390 | throw new OCSException('', 101); |
@@ -428,13 +428,13 @@ discard block |
||
| 428 | 428 | $currentLoggedInUser = $this->userSession->getUser(); |
| 429 | 429 | |
| 430 | 430 | $targetUser = $this->userManager->get($userId); |
| 431 | - if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) { |
|
| 431 | + if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) { |
|
| 432 | 432 | throw new OCSException('', 101); |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // If not permitted |
| 436 | 436 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 437 | - if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { |
|
| 437 | + if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { |
|
| 438 | 438 | throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | $loggedInUser = $this->userSession->getUser(); |
| 456 | 456 | |
| 457 | 457 | $targetUser = $this->userManager->get($userId); |
| 458 | - if($targetUser === null) { |
|
| 458 | + if ($targetUser === null) { |
|
| 459 | 459 | throw new OCSException('', \OCP\API::RESPOND_NOT_FOUND); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) { |
|
| 462 | + if ($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) { |
|
| 463 | 463 | // Self lookup or admin lookup |
| 464 | 464 | return new DataResponse([ |
| 465 | 465 | 'groups' => $this->groupManager->getUserGroupIds($targetUser) |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 469 | 469 | |
| 470 | 470 | // Looking up someone else |
| 471 | - if($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) { |
|
| 471 | + if ($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) { |
|
| 472 | 472 | // Return the group that the method caller is subadmin of for the user in question |
| 473 | 473 | /** @var IGroup[] $getSubAdminsGroups */ |
| 474 | 474 | $getSubAdminsGroups = $subAdminManager->getSubAdminsGroups($loggedInUser); |
@@ -498,16 +498,16 @@ discard block |
||
| 498 | 498 | * @throws OCSException |
| 499 | 499 | */ |
| 500 | 500 | public function addToGroup($userId, $groupid = '') { |
| 501 | - if($groupid === '') { |
|
| 501 | + if ($groupid === '') { |
|
| 502 | 502 | throw new OCSException('', 101); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | $group = $this->groupManager->get($groupid); |
| 506 | 506 | $targetUser = $this->userManager->get($userId); |
| 507 | - if($group === null) { |
|
| 507 | + if ($group === null) { |
|
| 508 | 508 | throw new OCSException('', 102); |
| 509 | 509 | } |
| 510 | - if($targetUser === null) { |
|
| 510 | + if ($targetUser === null) { |
|
| 511 | 511 | throw new OCSException('', 103); |
| 512 | 512 | } |
| 513 | 513 | |
@@ -535,17 +535,17 @@ discard block |
||
| 535 | 535 | public function removeFromGroup($userId, $groupid) { |
| 536 | 536 | $loggedInUser = $this->userSession->getUser(); |
| 537 | 537 | |
| 538 | - if($groupid === null) { |
|
| 538 | + if ($groupid === null) { |
|
| 539 | 539 | throw new OCSException('', 101); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | $group = $this->groupManager->get($groupid); |
| 543 | - if($group === null) { |
|
| 543 | + if ($group === null) { |
|
| 544 | 544 | throw new OCSException('', 102); |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | $targetUser = $this->userManager->get($userId); |
| 548 | - if($targetUser === null) { |
|
| 548 | + if ($targetUser === null) { |
|
| 549 | 549 | throw new OCSException('', 103); |
| 550 | 550 | } |
| 551 | 551 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) { |
| 570 | 570 | /** @var IGroup[] $subAdminGroups */ |
| 571 | 571 | $subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser); |
| 572 | - $subAdminGroups = array_map(function (IGroup $subAdminGroup) { |
|
| 572 | + $subAdminGroups = array_map(function(IGroup $subAdminGroup) { |
|
| 573 | 573 | return $subAdminGroup->getGID(); |
| 574 | 574 | }, $subAdminGroups); |
| 575 | 575 | $userGroups = $this->groupManager->getUserGroupIds($targetUser); |
@@ -601,15 +601,15 @@ discard block |
||
| 601 | 601 | $user = $this->userManager->get($userId); |
| 602 | 602 | |
| 603 | 603 | // Check if the user exists |
| 604 | - if($user === null) { |
|
| 604 | + if ($user === null) { |
|
| 605 | 605 | throw new OCSException('User does not exist', 101); |
| 606 | 606 | } |
| 607 | 607 | // Check if group exists |
| 608 | - if($group === null) { |
|
| 609 | - throw new OCSException('Group:'.$groupid.' does not exist', 102); |
|
| 608 | + if ($group === null) { |
|
| 609 | + throw new OCSException('Group:'.$groupid.' does not exist', 102); |
|
| 610 | 610 | } |
| 611 | 611 | // Check if trying to make subadmin of admin group |
| 612 | - if(strtolower($groupid) === 'admin') { |
|
| 612 | + if (strtolower($groupid) === 'admin') { |
|
| 613 | 613 | throw new OCSException('Cannot create subadmins for admin group', 103); |
| 614 | 614 | } |
| 615 | 615 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | return new DataResponse(); |
| 621 | 621 | } |
| 622 | 622 | // Go |
| 623 | - if($subAdminManager->createSubAdmin($user, $group)) { |
|
| 623 | + if ($subAdminManager->createSubAdmin($user, $group)) { |
|
| 624 | 624 | return new DataResponse(); |
| 625 | 625 | } else { |
| 626 | 626 | throw new OCSException('Unknown error occurred', 103); |
@@ -643,20 +643,20 @@ discard block |
||
| 643 | 643 | $subAdminManager = $this->groupManager->getSubAdmin(); |
| 644 | 644 | |
| 645 | 645 | // Check if the user exists |
| 646 | - if($user === null) { |
|
| 646 | + if ($user === null) { |
|
| 647 | 647 | throw new OCSException('User does not exist', 101); |
| 648 | 648 | } |
| 649 | 649 | // Check if the group exists |
| 650 | - if($group === null) { |
|
| 650 | + if ($group === null) { |
|
| 651 | 651 | throw new OCSException('Group does not exist', 101); |
| 652 | 652 | } |
| 653 | 653 | // Check if they are a subadmin of this said group |
| 654 | - if(!$subAdminManager->isSubAdminofGroup($user, $group)) { |
|
| 654 | + if (!$subAdminManager->isSubAdminofGroup($user, $group)) { |
|
| 655 | 655 | throw new OCSException('User is not a subadmin of this group', 102); |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // Go |
| 659 | - if($subAdminManager->deleteSubAdmin($user, $group)) { |
|
| 659 | + if ($subAdminManager->deleteSubAdmin($user, $group)) { |
|
| 660 | 660 | return new DataResponse(); |
| 661 | 661 | } else { |
| 662 | 662 | throw new OCSException('Unknown error occurred', 103); |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | public function getUserSubAdminGroups($userId) { |
| 674 | 674 | $user = $this->userManager->get($userId); |
| 675 | 675 | // Check if the user exists |
| 676 | - if($user === null) { |
|
| 676 | + if ($user === null) { |
|
| 677 | 677 | throw new OCSException('User does not exist', 101); |
| 678 | 678 | } |
| 679 | 679 | |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | $groups[$key] = $group->getGID(); |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | - if(!$groups) { |
|
| 686 | + if (!$groups) { |
|
| 687 | 687 | throw new OCSException('Unknown error occurred', 102); |
| 688 | 688 | } else { |
| 689 | 689 | return new DataResponse($groups); |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getGroups($search = '', $limit = null, $offset = null) { |
| 74 | 74 | if ($limit !== null) { |
| 75 | - $limit = (int)$limit; |
|
| 75 | + $limit = (int) $limit; |
|
| 76 | 76 | } |
| 77 | 77 | if ($offset !== null) { |
| 78 | - $offset = (int)$offset; |
|
| 78 | + $offset = (int) $offset; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $groups = $this->groupManager->search($search, $limit, $offset); |
@@ -100,21 +100,21 @@ discard block |
||
| 100 | 100 | $user = $this->userSession->getUser(); |
| 101 | 101 | |
| 102 | 102 | // Check the group exists |
| 103 | - if(!$this->groupManager->groupExists($groupId)) { |
|
| 103 | + if (!$this->groupManager->groupExists($groupId)) { |
|
| 104 | 104 | throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $isSubadminOfGroup = false; |
| 108 | 108 | $group = $this->groupManager->get($groupId); |
| 109 | 109 | if ($group !== null) { |
| 110 | - $isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminofGroup($user, $group); |
|
| 110 | + $isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminofGroup($user, $group); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Check subadmin has access to this group |
| 114 | - if($this->groupManager->isAdmin($user->getUID()) |
|
| 114 | + if ($this->groupManager->isAdmin($user->getUID()) |
|
| 115 | 115 | || $isSubadminOfGroup) { |
| 116 | 116 | $users = $this->groupManager->get($groupId)->getUsers(); |
| 117 | - $users = array_map(function($user) { |
|
| 117 | + $users = array_map(function($user) { |
|
| 118 | 118 | /** @var IUser $user */ |
| 119 | 119 | return $user->getUID(); |
| 120 | 120 | }, $users); |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function addGroup($groupid) { |
| 138 | 138 | // Validate name |
| 139 | - if(empty($groupid)){ |
|
| 139 | + if (empty($groupid)) { |
|
| 140 | 140 | \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR); |
| 141 | 141 | throw new OCSException('Invalid group name', 101); |
| 142 | 142 | } |
| 143 | 143 | // Check if it exists |
| 144 | - if($this->groupManager->groupExists($groupid)){ |
|
| 144 | + if ($this->groupManager->groupExists($groupid)) { |
|
| 145 | 145 | throw new OCSException('', 102); |
| 146 | 146 | } |
| 147 | 147 | $this->groupManager->createGroup($groupid); |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function deleteGroup($groupId) { |
| 159 | 159 | // Check it exists |
| 160 | - if(!$this->groupManager->groupExists($groupId)){ |
|
| 160 | + if (!$this->groupManager->groupExists($groupId)) { |
|
| 161 | 161 | throw new OCSException('', 101); |
| 162 | - } else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){ |
|
| 162 | + } else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) { |
|
| 163 | 163 | // Cannot delete admin group |
| 164 | 164 | throw new OCSException('', 102); |
| 165 | 165 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public function getSubAdminsOfGroup($groupId) { |
| 176 | 176 | // Check group exists |
| 177 | 177 | $targetGroup = $this->groupManager->get($groupId); |
| 178 | - if($targetGroup === null) { |
|
| 178 | + if ($targetGroup === null) { |
|
| 179 | 179 | throw new OCSException('Group does not exist', 101); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $currentChannel = $_['currentChannel']; |
| 15 | 15 | ?> |
| 16 | 16 | <form id="oca_updatenotification_section" class="followupsection"> |
| 17 | - <?php if($isNewVersionAvailable === true) { ?> |
|
| 17 | + <?php if ($isNewVersionAvailable === true) { ?> |
|
| 18 | 18 | <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> |
| 19 | 19 | <?php if ($_['updaterEnabled']) { ?> |
| 20 | 20 | <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | <label for="release-channel"><?php p($l->t('Update channel:')) ?></label> |
| 32 | 32 | <select id="release-channel"> |
| 33 | 33 | <option value="<?php p($currentChannel); ?>"><?php p($currentChannel); ?></option> |
| 34 | - <?php foreach ($channels as $channel => $channelTitle){ ?> |
|
| 34 | + <?php foreach ($channels as $channel => $channelTitle) { ?> |
|
| 35 | 35 | <option value="<?php p($channelTitle) ?>"> |
| 36 | 36 | <?php p($channelTitle) ?> |
| 37 | 37 | </option> |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']])); |
| 92 | 92 | |
| 93 | 93 | if ($this->isAdmin()) { |
| 94 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index') . '#updater'); |
|
| 94 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index').'#updater'); |
|
| 95 | 95 | } |
| 96 | 96 | } else { |
| 97 | 97 | $appInfo = $this->getAppInfo($notification->getObjectType()); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ]); |
| 112 | 112 | |
| 113 | 113 | if ($this->isAdmin()) { |
| 114 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps') . '#app-' . $notification->getObjectType()); |
|
| 114 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps').'#app-'.$notification->getObjectType()); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |