Lines
100.00%
19 / 19
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Roles | 100.00% | 19 / 19 | 100.00% | 1 / 1 | 2 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 19 / 19 | 100.00% | 1 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsadmin; | |
| 4 | ||
| 5 | use BO\Zmsentities\Exception\UserAccountMissingRights; | |
| 6 | use BO\Slim\Render; | |
| 7 | use Psr\Http\Message\RequestInterface; | |
| 8 | use Psr\Http\Message\ResponseInterface; | |
| 9 | ||
| 10 | class Roles extends BaseController | |
| 11 | { | |
| 12 | /** | |
| 13 | * @SuppressWarnings(Param) | |
| 14 | * | |
| 15 | * @return ResponseInterface | |
| 16 | */ | |
| 17 | #[\Override] | |
| 18 | public function readResponse( | |
| 19 | RequestInterface $request, | |
| 20 | ResponseInterface $response, | |
| 21 | array $args | |
| 22 | ) { | |
| 23 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); | |
| 24 | if (!$workstation->getUseraccount()->hasPermissions(['superuser'])) { | |
| 25 | throw new UserAccountMissingRights(); | |
| 26 | } | |
| 27 | ||
| 28 | $validator = $request->getAttribute('validator'); | |
| 29 | $success = $validator->getParameter('success')->isString()->getValue(); | |
| 30 | $error = $validator->getParameter('error')->isString()->getValue(); | |
| 31 | ||
| 32 | $roleList = \App::$http->readGetResult('/roles/', [])->getCollection(); | |
| 33 | ||
| 34 | return Render::withHtml( | |
| 35 | $response, | |
| 36 | 'page/rolesList.twig', | |
| 37 | [ | |
| 38 | 'title' => 'Rollen', | |
| 39 | 'menuActive' => 'roles', | |
| 40 | 'workstation' => $workstation, | |
| 41 | 'roleList' => $roleList, | |
| 42 | 'success' => $success, | |
| 43 | 'error' => $error, | |
| 44 | ] | |
| 45 | ); | |
| 46 | } | |
| 47 | } |