Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 32 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| UseraccountListByRole | |
0.00% |
0 / 32 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 1 |
| readResponse | |
0.00% |
0 / 32 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package Zmsadmin |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsadmin; |
| 9 | |
| 10 | use BO\Zmsentities\Collection\UseraccountList as Collection; |
| 11 | use Psr\Http\Message\RequestInterface; |
| 12 | use Psr\Http\Message\ResponseInterface; |
| 13 | |
| 14 | class UseraccountListByRole extends BaseController |
| 15 | { |
| 16 | /** |
| 17 | * @SuppressWarnings(Param) |
| 18 | * @return ResponseInterface |
| 19 | */ |
| 20 | public function readResponse( |
| 21 | RequestInterface $request, |
| 22 | ResponseInterface $response, |
| 23 | array $args |
| 24 | ) { |
| 25 | $roleLevel = $args['level']; |
| 26 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
| 27 | $success = $request->getAttribute('validator')->getParameter('success')->isString()->getValue(); |
| 28 | $ownerList = \App::$http->readGetResult('/owner/', array('resolveReferences' => 2))->getCollection(); |
| 29 | |
| 30 | $useraccountList = new Collection(); |
| 31 | if ($workstation->hasSuperUseraccount()) { |
| 32 | $useraccountList = \App::$http->readGetResult("/role/$roleLevel/useraccount/")->getCollection(); |
| 33 | } else { |
| 34 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity(); |
| 35 | $departmentList = $workstation->getUseraccount()->getDepartmentList(); |
| 36 | $departmentListIds = $departmentList->getIds(); |
| 37 | |
| 38 | if (!empty($departmentListIds)) { |
| 39 | $departmentUseraccountList = \App::$http |
| 40 | ->readGetResult( |
| 41 | "/role/$roleLevel/department/" . implode(',', $departmentListIds) . "/useraccount/", |
| 42 | ['resolveReferences' => 0] |
| 43 | ) |
| 44 | ->getCollection(); |
| 45 | if ($departmentUseraccountList) { |
| 46 | $useraccountList = $useraccountList->addList($departmentUseraccountList)->withoutDublicates(); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return \BO\Slim\Render::withHtml( |
| 52 | $response, |
| 53 | 'page/useraccountList.twig', |
| 54 | array( |
| 55 | 'title' => 'Nutzer', |
| 56 | 'roleLevel' => $roleLevel, |
| 57 | 'menuActive' => 'useraccount', |
| 58 | 'workstation' => $workstation, |
| 59 | 'useraccountListByRole' => $useraccountList, |
| 60 | 'ownerlist' => $ownerList, |
| 61 | 'success' => $success, |
| 62 | ) |
| 63 | ); |
| 64 | } |
| 65 | } |