mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
cs: Enable more risky rules.
This commit is contained in:
@@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Class EventController.
|
||||
|
@@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Class ParticipationController.
|
||||
|
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\RoleScope;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Add roles to existing groups.
|
||||
|
@@ -19,6 +19,7 @@ use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Class Participation.
|
||||
|
@@ -15,6 +15,7 @@ use RuntimeException;
|
||||
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
|
||||
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
|
||||
use function call_user_func;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@@ -27,6 +27,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Class PickEventType.
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Search within Events.
|
||||
|
@@ -20,6 +20,8 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Description of EventVoter.
|
||||
@@ -86,7 +88,7 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
|
||||
public function supports($attribute, $subject)
|
||||
{
|
||||
return ($subject instanceof Event && in_array($attribute, self::ROLES))
|
||||
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
|
||||
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE]))
|
||||
|| (null === $subject && self::SEE === $attribute);
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,8 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
@@ -83,7 +85,7 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
public function supports($attribute, $subject)
|
||||
{
|
||||
return ($subject instanceof Participation && in_array($attribute, self::ROLES))
|
||||
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
|
||||
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE]))
|
||||
|| (null === $subject && self::SEE === $attribute);
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,8 @@
|
||||
namespace Chill\EventBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Test the creation of participation controller.
|
||||
|
@@ -13,6 +13,7 @@ use Chill\EventBundle\Entity\Event;
|
||||
use Chill\EventBundle\Search\EventSearch;
|
||||
use DateTime;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Test the EventSearch class.
|
||||
|
@@ -22,6 +22,7 @@ use LogicException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Class TimelineEventProvider.
|
||||
|
Reference in New Issue
Block a user