| Total Complexity | 4 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class PartVoter extends ExtendedVoter |
||
| 22 | { |
||
| 23 | const READ = "read"; |
||
| 24 | |||
| 25 | |||
| 26 | protected function supports($attribute, $subject) |
||
| 27 | { |
||
| 28 | // replace with your own logic |
||
| 29 | // https://symfony.com/doc/current/security/voters.html |
||
| 30 | //return ($subject instanceof Part || in_array($subject, ['PERM_parts', 'PERM_parts_name'])); |
||
| 31 | |||
| 32 | if ($subject instanceof Part) |
||
| 33 | { |
||
| 34 | return in_array($attribute, $this->resolver->listOperationsForPermission('parts'), false); |
||
| 35 | } |
||
| 36 | |||
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | |||
| 41 | protected function voteOnUser($attribute, $subject, User $user): bool |
||
| 50 | } |
||
| 51 | } |
||
| 52 |