mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Remove usage of deprecated Role class
This commit is contained in:
@@ -53,7 +53,6 @@ use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function in_array;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
@@ -410,7 +409,7 @@ class ActivityType extends AbstractType
|
||||
$resolver
|
||||
->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod'])
|
||||
->setAllowedTypes('center', ['null', Center::class])
|
||||
->setAllowedTypes('role', [Role::class, 'string'])
|
||||
->setAllowedTypes('role', ['string'])
|
||||
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
|
||||
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']);
|
||||
}
|
||||
|
@@ -354,14 +354,14 @@ final class ActivityControllerTest extends WebTestCase
|
||||
->get('chill.main.security.authorization.helper')
|
||||
->getReachableScopes(
|
||||
$user,
|
||||
new Role('CHILL_ACTIVITY_UPDATE'),
|
||||
'CHILL_ACTIVITY_UPDATE',
|
||||
$center
|
||||
);
|
||||
$reachableScopesDelete = self::$kernel->getContainer()
|
||||
->get('chill.main.security.authorization.helper')
|
||||
->getReachableScopes(
|
||||
$user,
|
||||
new Role('CHILL_ACTIVITY_DELETE'),
|
||||
'CHILL_ACTIVITY_DELETE',
|
||||
$center
|
||||
);
|
||||
$reachableScopesId = array_intersect(
|
||||
|
@@ -30,11 +30,6 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
*/
|
||||
protected $center;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\Form\FormBuilderInterface
|
||||
*/
|
||||
@@ -85,7 +80,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
$form = $this->formBuilder
|
||||
->add('activity', ActivityType::class, [
|
||||
'center' => $this->center,
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
'role' => 'CHILL_ACTIVITY_CREATE',
|
||||
])
|
||||
->getForm();
|
||||
|
||||
@@ -101,7 +96,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
$form = $this->formBuilder
|
||||
->add('activity', ActivityType::class, [
|
||||
'center' => $this->center,
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
'role' => 'CHILL_ACTIVITY_CREATE',
|
||||
])
|
||||
->getForm();
|
||||
|
||||
@@ -157,7 +152,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
$form = $builder
|
||||
->add('activity', ActivityType::class, [
|
||||
'center' => $this->center,
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
'role' => 'CHILL_ACTIVITY_CREATE',
|
||||
])
|
||||
->getForm();
|
||||
|
||||
|
@@ -141,8 +141,8 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
$parameters = [];
|
||||
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
||||
$associationMapping = $metadataActivity->getAssociationMapping('person');
|
||||
$role = new Role('CHILL_ACTIVITY_SEE');
|
||||
$reachableScopes = $this->helper->getReachableScopes($this->user, $role->getRole(), $person->getCenter());
|
||||
$role = 'CHILL_ACTIVITY_SEE';
|
||||
$reachableScopes = $this->helper->getReachableScopes($this->user, $role, $person->getCenter());
|
||||
$whereClause = ' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ';
|
||||
$scopes_ids = [];
|
||||
|
||||
|
Reference in New Issue
Block a user