Skip to content

Commit

Permalink
Transform autorieation to Voter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Apr 25, 2023
1 parent c60660b commit 1558898
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Domain/UseCase/IsAnAuthorizedIp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IsAnAuthorizedIp

public function __construct(ParameterBagInterface $parameterBag)
{
$this->ipAddresses = $parameterBag->get('lexik_maintenance.authorized.ips');
$this->ipAddresses = (array) $parameterBag->get('lexik_maintenance.authorized.ips');
}

public function __invoke(string $ip): bool
Expand Down
1 change: 0 additions & 1 deletion src/Infrastructure/FormType/MaintenanceFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class MaintenanceFormType extends AbstractType
{
/* @phpstan-ignore-next-line */
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Voter/MaintenanceAdministrationVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public function __construct(HasAccessToAdministration $hasAccessToAdministration
$this->hasAccessToAdministration = $hasAccessToAdministration;
}

protected function supports($attribute, $subject)
protected function supports(string $attribute, $subject)
{
return \in_array($attribute, [self::EDIT_ADMINISTRATION_MAINTENANCE], true);
}

protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token)
{
switch ($attribute) {
case self::EDIT_ADMINISTRATION_MAINTENANCE:
Expand Down

0 comments on commit 1558898

Please sign in to comment.