|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
protected RolesDefinitionInterface $rolesDefinition; |
|
|
protected RolesDefinitionInterface $rolesDefinition; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct( |
|
|
|
|
|
RolesDefinitionInterface $rolesDefinition |
|
|
|
|
|
) { |
|
|
|
|
|
$this->rolesDefinition = $rolesDefinition; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function buildIndexActions(Actions $actions): void |
|
|
public function buildIndexActions(Actions $actions): void |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
public function getSwitchUserAction(): Action |
|
|
public function getSwitchUserAction(): Action |
|
|
{ |
|
|
{ |
|
|
$switchAction = Action::new( |
|
|
$switchAction = Action::new( |
|
|
ActionDefinition::SWITCH_USER, |
|
|
|
|
|
$this->get(TranslatorAdmin::class)->transAction(ActionDefinition::SWITCH_USER), |
|
|
|
|
|
'fa fa-fw fa-user-secret' |
|
|
|
|
|
|
|
|
ActionDefinition::SWITCH_USER, |
|
|
|
|
|
$this->get(TranslatorAdmin::class)->transAction(ActionDefinition::SWITCH_USER), |
|
|
|
|
|
'fa fa-fw fa-user-secret' |
|
|
) |
|
|
) |
|
|
->linkToCrudAction(ActionDefinition::SWITCH_USER) |
|
|
|
|
|
->setLabel($this->get(TranslatorAdmin::class)->transAction(ActionDefinition::SWITCH_USER)) |
|
|
|
|
|
->setCssClass('in-dropdown text-info action-confirm action_switch'); |
|
|
|
|
|
|
|
|
->linkToCrudAction(ActionDefinition::SWITCH_USER) |
|
|
|
|
|
->setLabel($this->get(TranslatorAdmin::class)->transAction(ActionDefinition::SWITCH_USER)) |
|
|
|
|
|
->setCssClass('in-dropdown text-info action-confirm action_switch'); |
|
|
|
|
|
|
|
|
return $switchAction; |
|
|
return $switchAction; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
parent::overrideEntitiesActions($entities); // TODO: Change the autogenerated stub |
|
|
parent::overrideEntitiesActions($entities); // TODO: Change the autogenerated stub |
|
|
foreach ($entities as $entity) { |
|
|
foreach ($entities as $entity) { |
|
|
foreach ($entity->getActions() as $action){ |
|
|
|
|
|
if($action->getName() == ActionDefinition::SWITCH_USER){ |
|
|
|
|
|
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail())); |
|
|
|
|
|
|
|
|
foreach ($entity->getActions() as $action) { |
|
|
|
|
|
if ($action->getName() == ActionDefinition::SWITCH_USER) { |
|
|
|
|
|
$url = $this->generateUrl( |
|
|
|
|
|
$this->getParameter('lc_sov.homepage_route'), |
|
|
|
|
|
array('_switch_user' => $entity->getInstance()->getEmail()) |
|
|
|
|
|
); |
|
|
$action->setLinkUrl($url); |
|
|
$action->setLinkUrl($url); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function configureFields(string $pageName): iterable |
|
|
public function configureFields(string $pageName): iterable |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
EmailField::new('email'), |
|
|
|
|
|
TextField::new('lastname'), |
|
|
|
|
|
TextField::new('firstname'), |
|
|
|
|
|
ChoiceField::new('roles') |
|
|
|
|
|
->allowMultipleChoices() |
|
|
|
|
|
->autocomplete() |
|
|
|
|
|
->setChoices($this->rolesDefinition->getRolesList()) |
|
|
|
|
|
|
|
|
EmailField::new('email'), |
|
|
|
|
|
TextField::new('lastname'), |
|
|
|
|
|
TextField::new('firstname'), |
|
|
|
|
|
ChoiceField::new('roles') |
|
|
|
|
|
->allowMultipleChoices() |
|
|
|
|
|
->autocomplete() |
|
|
|
|
|
->setChoices($this->rolesDefinition->getRolesList()) |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|