Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
23 | public function fileDeleteAction(Request $request) |
||
24 | { |
||
25 | if (!$this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) { |
||
26 | throw new \Exception('Access denied'); |
||
27 | } |
||
28 | |||
29 | $id = $request->get('attach_file'); |
||
30 | $attach_file = AttachFileQuery::create()->findOneById($id); |
||
31 | |||
32 | $success = $attach_file ? $attach_file->deleteFile() : false; |
||
33 | |||
34 | $response = new JsonResponse(array( |
||
35 | 'success' => $success, |
||
36 | )); |
||
37 | return $response; |
||
38 | } |
||
39 | } |