Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| LogoutBySuperuser | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
| readResponse | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package Zmsadmin |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsadmin; |
| 9 | |
| 10 | use BO\Zmsclient\Auth; |
| 11 | use BO\Mellon\Validator; |
| 12 | |
| 13 | class LogoutBySuperuser extends BaseController |
| 14 | { |
| 15 | /** |
| 16 | * @SuppressWarnings(Param) |
| 17 | * @return String |
| 18 | */ |
| 19 | public function readResponse( |
| 20 | \Psr\Http\Message\RequestInterface $request, |
| 21 | \Psr\Http\Message\ResponseInterface $response, |
| 22 | array $args |
| 23 | ) { |
| 24 | $validator = $request->getAttribute('validator'); |
| 25 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 0])->getEntity(); |
| 26 | $workstationToLogout = $validator->getParameter('workstation')->isArray()->getValue(); |
| 27 | |
| 28 | if ( |
| 29 | array_key_exists('useraccount', $workstationToLogout) && |
| 30 | isset($workstationToLogout['useraccount']['id']) && |
| 31 | $workstation->hasSuperUseraccount() |
| 32 | ) { |
| 33 | \App::$http->readDeleteResult('/workstation/login/' . $workstationToLogout['useraccount']['id'] . '/'); |
| 34 | } |
| 35 | |
| 36 | $departmentId = Validator::value($args['id'])->isNumber()->getValue(); |
| 37 | return \BO\Slim\Render::redirect( |
| 38 | 'useraccountByDepartment', |
| 39 | array('id' => $departmentId), |
| 40 | array() |
| 41 | ); |
| 42 | } |
| 43 | } |