Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RoleDelete | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| readResponse | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsadmin; |
| 4 | |
| 5 | use BO\Mellon\Validator; |
| 6 | use BO\Zmsentities\Exception\UserAccountMissingRights; |
| 7 | |
| 8 | class RoleDelete extends BaseController |
| 9 | { |
| 10 | public function readResponse( |
| 11 | \Psr\Http\Message\RequestInterface $request, |
| 12 | \Psr\Http\Message\ResponseInterface $response, |
| 13 | array $args |
| 14 | ) { |
| 15 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
| 16 | if (!$workstation->getUseraccount()->hasPermissions(['superuser'])) { |
| 17 | throw new UserAccountMissingRights(); |
| 18 | } |
| 19 | |
| 20 | $roleId = (int) Validator::value($args['id'] ?? null)->isNumber()->getValue(); |
| 21 | \App::$http->readDeleteResult('/roles/' . $roleId . '/', [])->getEntity(); |
| 22 | |
| 23 | return $response->withStatus(204); |
| 24 | } |
| 25 | } |