helper = $helper; } public function getRoles(): array { return [self::CREATE, self::UPDATE, self::SEE, self::LISTS]; } public function getRolesWithHierarchy(): array { return ['Report' => $this->getRoles()]; } public function getRolesWithoutScope(): array { return [self::LISTS]; } protected function supports($attribute, $subject) { if ($subject instanceof Report) { return in_array($attribute, [ self::CREATE, self::UPDATE, self::SEE, ], true); } if ($subject instanceof Center) { return self::LISTS === $attribute; } } protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { if (!$token->getUser() instanceof User) { return false; } return $this->helper->userHasAccess($token->getUser(), $subject, $attribute); } }