Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
91.67% |
11 / 12 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| OwnerDelete | |
91.67% |
11 / 12 |
|
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
| readResponse | |
91.67% |
11 / 12 |
|
0.00% |
0 / 1 |
2.00 | |||
| 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\Exception\UserAccountMissingRights; |
| 11 | use BO\Mellon\Validator; |
| 12 | use BO\Slim\Render; |
| 13 | |
| 14 | /** |
| 15 | * Delete an Owner |
| 16 | * |
| 17 | */ |
| 18 | class OwnerDelete extends BaseController |
| 19 | { |
| 20 | /** |
| 21 | * @return \Psr\Http\Message\ResponseInterface |
| 22 | */ |
| 23 | #[\Override] |
| 24 | public function readResponse( |
| 25 | \Psr\Http\Message\RequestInterface $request, |
| 26 | \Psr\Http\Message\ResponseInterface $response, |
| 27 | array $args |
| 28 | ): \Psr\Http\Message\ResponseInterface { |
| 29 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
| 30 | if (!$workstation->getUseraccount()->hasPermissions(['jurisdiction'])) { |
| 31 | throw new UserAccountMissingRights(); |
| 32 | } |
| 33 | $entityId = Validator::value($args['id'])->isNumber()->getValue(); |
| 34 | \App::$http->readDeleteResult('/owner/' . $entityId . '/')->getEntity(); |
| 35 | return \BO\Slim\Render::redirect( |
| 36 | 'owner_overview', |
| 37 | array(), |
| 38 | array( |
| 39 | 'success' => 'owner_deleted' |
| 40 | ) |
| 41 | ); |
| 42 | } |
| 43 | } |