Remove usage of deprecated Role class

This commit is contained in:
2023-08-31 17:08:18 +02:00
parent 76142c1264
commit 7c58880139
33 changed files with 55 additions and 80 deletions

View File

@@ -52,7 +52,7 @@ class NotificationType extends AbstractType
'empty_collection_explain' => 'notification.Any email',
'entry_options' => [
'constraints' => [
new NotNull(), new NotBlank(), new Email(['checkMX' => true]),
new NotNull(), new NotBlank(), new Email(),
],
'label' => 'Email',
],

View File

@@ -97,7 +97,7 @@ trait AppendScopeChoiceTypeTrait
*/
protected function appendScopeChoices(
FormBuilderInterface $builder,
Role $role,
string $role,
Center $center,
User $user,
AuthorizationHelper $authorizationHelper,

View File

@@ -52,7 +52,7 @@ class ScopePickerType extends AbstractType
array_filter(
$this->authorizationHelper->getReachableScopes(
$this->security->getUser(),
$options['role'] instanceof Role ? $options['role']->getRole() : $options['role'],
$options['role'],
$options['center']
),
static fn (Scope $s) => $s->isActive()
@@ -92,6 +92,6 @@ class ScopePickerType extends AbstractType
->setAllowedTypes('center', [Center::class, 'array', 'null'])
// create ``role` option
->setRequired('role')
->setAllowedTypes('role', ['string', Role::class]);
->setAllowedTypes('role', ['string']);
}
}

View File

@@ -63,7 +63,7 @@ class UserPickerType extends AbstractType
->setAllowedTypes('center', [\Chill\MainBundle\Entity\Center::class, 'null', 'array'])
// create ``role` option
->setRequired('role')
->setAllowedTypes('role', ['string', \Symfony\Component\Security\Core\Role\Role::class]);
->setAllowedTypes('role', ['string']);
$resolver
->setDefault('having_permissions_group_flag', null)
@@ -74,11 +74,7 @@ class UserPickerType extends AbstractType
->setDefault('scope', null)
->setAllowedTypes('scope', [Scope::class, 'array', 'null'])
->setNormalizer('choices', function (Options $options) {
if ($options['role'] instanceof Role) {
$role = $options['role']->getRole();
} else {
$role = $options['role'];
}
$role = $options['role'];
$users = $this->userACLAwareRepository
->findUsersByReachedACL($role, $options['center'], $options['scope'], true);

View File

@@ -159,7 +159,7 @@ class WorkflowStepType extends AbstractType
'empty_collection_explain' => 'workflow.Any email',
'entry_options' => [
'constraints' => [
new NotNull(), new NotBlank(), new Email(['checkMX' => true]),
new NotNull(), new NotBlank(), new Email(),
],
'label' => 'Email',
],