Conditions | 5 |
Paths | 10 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
31 | public function createFromRequest(Request $request, bool $normalization, array $extractedAttributes = null): array |
||
32 | { |
||
33 | $context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes); |
||
34 | if (!isset($context['groups'])) { |
||
35 | $context['groups'] = ['default']; |
||
36 | } |
||
37 | if (isset($context['groups'])) { |
||
38 | if ($this->authorizationChecker->isGranted('ROLE_ADMIN')) { |
||
39 | $context['groups'][] = 'admin'; |
||
40 | } |
||
41 | if ($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) { |
||
42 | $context['groups'][] = 'super_admin'; |
||
43 | } |
||
44 | } |
||
45 | |||
46 | return $context; |
||
47 | } |
||
49 |