| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool |
||
| 39 | { |
||
| 40 | $resourceFile = $subject; |
||
| 41 | $resourceNode = $resourceFile->getResourceNode(); |
||
| 42 | |||
| 43 | if ($this->accessDecisionManager->decide($token, ['ROLE_ADMIN'])) { |
||
| 44 | return true; |
||
| 45 | } |
||
| 46 | |||
| 47 | return match ($attribute) { |
||
| 48 | self::DOWNLOAD => $this->accessDecisionManager->decide( |
||
| 49 | $token, |
||
| 50 | [ResourceNodeVoter::VIEW], |
||
| 51 | $resourceNode |
||
| 52 | ), |
||
| 53 | default => false, |
||
| 54 | }; |
||
| 57 |