Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into release/3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pablothedude committed Mar 5, 2020
2 parents 7463bff + efa6b93 commit a8106ff
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.1.2
**Bugfix**
* Repair the token export feature #234

## 3.1.1
**Bugfix**
* Remove filter from ra candidate search form #233
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ final class ExportRaSecondFactorsCommand
const STATUS_VETTED = 'vetted';
const STATUS_REVOKED = 'revoked';

/**
* @Assert\NotBlank(message="ra.search_ra_second_factors.institution.blank")
* @Assert\Type("string", message="ra.search_ra_second_factors.institution.type")
*
* @var string
*/
public $actorInstitution;

/**
* @Assert\NotBlank(message="ra.search_ra_second_factors.actor.blank")
* @Assert\Type("string", message="ra.search_ra_second_factors.actor.type")
Expand Down Expand Up @@ -104,7 +96,6 @@ public static function fromSearchCommand(SearchRaSecondFactorsCommand $command)
{
$exportCommand = new self;

$exportCommand->actorInstitution = $command->actorInstitution;
$exportCommand->actorId = $command->actorId;
$exportCommand->name = $command->name;
$exportCommand->type = $command->type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public function searchAction(Request $request)
// The options that will populate the institution filter choice list.
$command->institutionFilterOptions = $secondFactors->getFilterOption('institution');

$form = $this->createForm(SearchRaSecondFactorsType::class, $command, ['method' => 'get']);
$form = $this->createForm(SearchRaSecondFactorsType::class, $command, [
'method' => 'get',
'enable_export_button' => $this->isGranted(['ROLE_RAA']),
]);
$form->handleRequest($request);

$secondFactors = $this->getSecondFactorService()->search($command);
Expand Down Expand Up @@ -99,7 +102,7 @@ public function searchAction(Request $request)

public function exportAction(SearchRaSecondFactorsCommand $command)
{
$this->denyAccessUnlessGranted(['ROLE_RA']);
$this->denyAccessUnlessGranted(['ROLE_RAA']);

$this->get('logger')->notice('Starting export of searched second factors');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,39 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'required' => false,
]);

$builder->add(
$builder->create(
'button-group',
FormType::class,
[
'inherit_data' => true,
// The empty label ensures the buttons are positioned correctly
'label' => ' ',
'widget_form_group_attr' => ['class' => 'form-group button-group'],
]
)
$buttonGroup = $builder->create(
'button-group',
FormType::class,
[
'inherit_data' => true,
// The empty label ensures the buttons are positioned correctly
'label' => ' ',
'widget_form_group_attr' => ['class' => 'form-group button-group'],
]
)
->add('search', SubmitType::class, [
'label' => 'ra.form.ra_search_ra_second_factors.button.search',
'attr' => [ 'class' => 'btn btn-primary pull-left button-group-member' ],
])
->add('export', SubmitType::class, [
]);

if ($options['enable_export_button']) {
$buttonGroup->add('export', SubmitType::class, [
'label' => 'ra.form.ra_search_ra_second_factors.button.export',
'attr' => [ 'class' => 'btn btn-secondary pull-left button-group-member' ],
])
);
'attr' => ['class' => 'btn btn-secondary pull-left button-group-member'],
]);
}

$builder->add($buttonGroup);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Surfnet\StepupRa\RaBundle\Command\SearchRaSecondFactorsCommand',
'enable_export_button' => true,
]);

$resolver->setAllowedTypes('enable_export_button', 'bool');
}

public function getBlockPrefix()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function search(SearchRaSecondFactorsCommand $command)
*/
public function export(ExportRaSecondFactorsCommand $command)
{
$query = new RaSecondFactorExportQuery($command->actorInstitution, $command->actorId);
$query = new RaSecondFactorExportQuery($command->actorId);

if ($command->name) {
$query->setName($command->name);
Expand Down

0 comments on commit a8106ff

Please sign in to comment.