mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fix cs
This commit is contained in:
@@ -17,12 +17,15 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use UnexpectedValueException;
|
||||
use function get_class;
|
||||
use function in_array;
|
||||
|
||||
class AccompanyingPeriodWorkVoter extends Voter
|
||||
{
|
||||
public const CREATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE';
|
||||
|
||||
public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE';
|
||||
|
||||
public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE';
|
||||
|
||||
private Security $security;
|
||||
@@ -40,7 +43,7 @@ class AccompanyingPeriodWorkVoter extends Voter
|
||||
&& in_array($attribute, $this->getRoles(), true)
|
||||
) || (
|
||||
$subject instanceof AccompanyingPeriod
|
||||
&& in_array($attribute, [self::SEE, self::CREATE])
|
||||
&& in_array($attribute, [self::SEE, self::CREATE], true)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,8 +67,10 @@ class AccompanyingPeriodWorkVoter extends Voter
|
||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject);
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException(sprintf("attribute {$attribute} is not supported on instance %s",
|
||||
AccompanyingPeriod::class));
|
||||
throw new UnexpectedValueException(sprintf(
|
||||
"attribute {$attribute} is not supported on instance %s",
|
||||
AccompanyingPeriod::class
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user