diff --git a/lib/Alchemy/Phrasea/Controller/Admin/RootController.php b/lib/Alchemy/Phrasea/Controller/Admin/RootController.php index cadb726c04..6bb203128d 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/RootController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/RootController.php @@ -17,6 +17,7 @@ use Alchemy\Phrasea\Databox\Subdef\MediaSubdefRepository; use Alchemy\Phrasea\Exception\SessionNotFound; use Alchemy\Phrasea\Model\Entities\ApiApplication; +use Alchemy\Phrasea\Model\Manipulator\ApiApplicationManipulator; use Alchemy\Phrasea\Model\Manipulator\ApiOauthTokenManipulator; use Alchemy\Phrasea\Model\Repositories\ApiAccountRepository; use Alchemy\Phrasea\Model\Repositories\ApiOauthTokenRepository; @@ -507,6 +508,13 @@ public function renewAccessToken(Request $request, ApiApplication $application) return $this->app->json(['success' => true]); } + public function deleteApplication(Request $request, ApiApplication $application) + { + $this->getApiApplicationManipulator()->delete($application); + + return $this->app->json(['success' => true]); + } + /** * @return ApiOauthTokenRepository */ @@ -582,4 +590,12 @@ private function getSectionParameters($section) 'off_databoxes' => $off_databoxes, ]; } + + /** + * @return ApiApplicationManipulator + */ + private function getApiApplicationManipulator() + { + return $this->app['manipulator.api-application']; + } } diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Root.php b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Root.php index 600d44f12b..cbc713e8b4 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Root.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Root.php @@ -94,6 +94,11 @@ public function connect(Application $app) ->assert('application', '\d+') ->bind('admin_inspector_application_token'); + $controllers->post('/inspector/application/{application}/delete/', 'controller.admin.root:deleteApplication') + ->before($app['middleware.api-application.converter']) + ->assert('application', '\d+') + ->bind('admin_inspector_application_delete'); + return $controllers; } } diff --git a/templates/web/admin/inspector/record-index.html.twig b/templates/web/admin/inspector/record-index.html.twig index 74238efb6d..5d9ce7330d 100644 --- a/templates/web/admin/inspector/record-index.html.twig +++ b/templates/web/admin/inspector/record-index.html.twig @@ -82,6 +82,7 @@