make aggregor take roles into account

This commit is contained in:
Julien Fastré 2016-01-26 11:47:04 +01:00
parent 0ab2e85aef
commit 2f9b4a8c81
2 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Role\Role;
/** /**
* *
@ -82,4 +84,10 @@ class GenderAggregator implements AggregatorInterface
'_header' => $this->translator->trans('Gender') '_header' => $this->translator->trans('Gender')
); );
} }
public function requiredRole()
{
return new Role(PersonVoter::STATS);
}
} }

View File

@ -25,6 +25,8 @@ use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
/** /**
* *
@ -123,6 +125,11 @@ class NationalityAggregator implements AggregatorInterface
return array('nationality_aggregator'); return array('nationality_aggregator');
} }
public function requiredRole()
{
return new Role(PersonVoter::STATS);
}
public function getLabels($key, array $values, $data) public function getLabels($key, array $values, $data)
{ {
if ($data['group_by_level'] === 'country') { if ($data['group_by_level'] === 'country') {