mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use function in_array;
|
||||
|
||||
final class DefaultVoterHelper implements VoterHelperInterface
|
||||
{
|
||||
protected AuthorizationHelper $authorizationHelper;
|
||||
private AuthorizationHelper $authorizationHelper;
|
||||
|
||||
protected CenterResolverDispatcherInterface $centerResolverDispatcher;
|
||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
||||
|
||||
protected array $configuration = [];
|
||||
private array $configuration = [];
|
||||
|
||||
/**
|
||||
* @param array $configuration
|
||||
*/
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
CenterResolverDispatcherInterface $centerResolverDispatcher,
|
||||
@@ -31,13 +35,13 @@ final class DefaultVoterHelper implements VoterHelperInterface
|
||||
|
||||
public function supports($attribute, $subject): bool
|
||||
{
|
||||
foreach ($this->configuration as list($attributes, $subj)) {
|
||||
if ($subj === null) {
|
||||
if ($subject === null && \in_array($attribute, $attributes, true)) {
|
||||
foreach ($this->configuration as [$attributes, $subj]) {
|
||||
if (null === $subj) {
|
||||
if (null === $subject && in_array($attribute, $attributes, true)) {
|
||||
return true;
|
||||
}
|
||||
} elseif ($subject instanceof $subj) {
|
||||
return \in_array($attribute, $attributes, true);
|
||||
return in_array($attribute, $attributes, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +54,7 @@ final class DefaultVoterHelper implements VoterHelperInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NULL === $subject) {
|
||||
if (null === $subject) {
|
||||
return [] !== $this->authorizationHelper->getReachableCenters($token->getUser(), $attribute, null);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user