add ACL for export

This commit is contained in:
Julien Fastré 2016-01-24 22:25:55 +01:00
parent c74754af09
commit 9cb37a6115
3 changed files with 14 additions and 2 deletions

View File

@ -24,6 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Role\Role;
/**
*
@ -78,4 +79,9 @@ class GenderFilter implements FilterInterface
{
return 'Filter by person gender';
}
public function requiredRole()
{
return new Role(\Chill\PersonBundle\Security\Authorization\PersonVoter::STATS);
}
}

View File

@ -23,6 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\FilterInterface;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Role\Role;
/**
*
@ -63,4 +64,9 @@ class NationalityFilter implements FilterInterface
{
return "Filter by person's nationality";
}
public function requiredRole()
{
return new Role(\Chill\PersonBundle\Security\Authorization\PersonVoter::STATS);
}
}

View File

@ -49,12 +49,12 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleInterface
protected function getSupportedAttributes()
{
return array(self::CREATE, self::UPDATE, self::SEE);
return array(self::CREATE, self::UPDATE, self::SEE, self::STATS);
}
protected function getSupportedClasses()
{
return array('Chill\PersonBundle\Entity\Person');
return array('Chill\PersonBundle\Entity\Person', 'Chill\MainBundle\Entity\Center');
}
protected function isGranted($attribute, $person, $user = null)