1 | <?php |
||
29 | final class RaSecondFactorController extends Controller |
||
30 | { |
||
31 | /** |
||
32 | * @var RaSecondFactorService |
||
33 | */ |
||
34 | private $raSecondFactorService; |
||
35 | |||
36 | public function __construct(RaSecondFactorService $raSecondFactorService) |
||
40 | |||
41 | public function collectionAction(Request $request, Institution $institution) |
||
42 | { |
||
43 | $this->denyAccessUnlessGranted(['ROLE_RA']); |
||
44 | |||
45 | $query = $this->buildRaSecondFactorQuery($request, $institution); |
||
46 | |||
47 | $paginator = $this->raSecondFactorService->search($query); |
||
48 | |||
49 | return JsonCollectionResponse::fromPaginator($paginator); |
||
50 | } |
||
51 | |||
52 | public function exportAction(Request $request, Institution $institution) |
||
53 | { |
||
54 | $this->denyAccessUnlessGranted(['ROLE_RA']); |
||
55 | |||
56 | $query = $this->buildRaSecondFactorQuery($request, $institution); |
||
57 | |||
58 | $results = $this->raSecondFactorService->searchUnpaginated($query); |
||
59 | |||
60 | return new JsonResponse($results); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param Request $request |
||
65 | * @param Institution $institution |
||
66 | * @return RaSecondFactorQuery |
||
67 | */ |
||
68 | private function buildRaSecondFactorQuery(Request $request, Institution $institution) |
||
83 | } |
||
84 |