Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
RoleDelete
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace BO\Zmsadmin;
4
5use BO\Mellon\Validator;
6use BO\Zmsentities\Exception\UserAccountMissingRights;
7
8class 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}