1 | <?php |
||
22 | class AccessVoter extends Voter |
||
23 | { |
||
24 | /** |
||
25 | * View action for exchange rate |
||
26 | */ |
||
27 | const VIEW = 'view'; |
||
28 | |||
29 | /** |
||
30 | * Create new exchange rate action |
||
31 | */ |
||
32 | const CREATE = 'create'; |
||
33 | |||
34 | /** |
||
35 | * Edit exchange rate action |
||
36 | */ |
||
37 | const EDIT = 'edit'; |
||
38 | |||
39 | /** |
||
40 | * Delete exchange rate action |
||
41 | */ |
||
42 | const DELETE = 'delete'; |
||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $roles; |
||
48 | |||
49 | public function __construct(array $roles = []) |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | protected function supports($attribute, $subject) |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) |
||
92 | |||
93 | /** |
||
94 | * Check if token has any of given roles. |
||
95 | * |
||
96 | * @param TokenInterface $token |
||
97 | * @param array $roles |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | private function hasAnyRole(TokenInterface $token, array $roles) |
||
117 | } |
||
118 |