Commit be2edec6 authored by Julien Fastré's avatar Julien Fastré

add specific role for LIST and STAT

parent 1bc93af1
Pipeline #14049 failed with stages
in 1 minute and 6 seconds
......@@ -24,6 +24,7 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\Entity\RoleScope;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
/**
* Add a role CHILL_PERSON_UPDATE & CHILL_PERSON_CREATE for all groups except administrative,
......@@ -57,6 +58,14 @@ class LoadPersonACL extends AbstractFixture implements OrderedFixtureInterface
->setRole('CHILL_PERSON_CREATE')
->setScope(null);
$permissionsGroup->addRoleScope($roleScopeCreate);
$roleScopeList = (new RoleScope())
->setRole(PersonVoter::LISTS)
->setScope(null);
$permissionsGroup->addRoleScope($roleScopeList);
$roleScopeStats = (new RoleScope())
->setRole(PersonVoter::STATS)
->setScope(null);
$permissionsGroup->addRoleScope($roleScopeStats);
$manager->persist($roleScopeUpdate);
$manager->persist($roleScopeCreate);
break;
......
......@@ -160,8 +160,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$container->prependExtensionConfig('security', array(
'role_hierarchy' => array(
'CHILL_PERSON_UPDATE' => array('CHILL_PERSON_SEE'),
'CHILL_PERSON_CREATE' => array('CHILL_PERSON_SEE'),
'CHILL_PERSON_SEE' => array(PersonVoter::STATS)
'CHILL_PERSON_CREATE' => array('CHILL_PERSON_SEE')
)
));
}
......
......@@ -421,7 +421,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
*/
public function requiredRole()
{
return new Role(PersonVoter::STATS);
return new Role(PersonVoter::LISTS);
}
/**
......
......@@ -141,6 +141,7 @@ CHILL_PERSON_SEE: Voir les personnes
CHILL_PERSON_UPDATE: Modifier les personnes
CHILL_PERSON_CREATE: Ajouter des personnes
CHILL_PERSON_STATS: Statistiques sur les personnes
CHILL_PERSON_LISTS: Liste des personnes
#period
Period closed!: Période clôturée!
......
......@@ -35,6 +35,7 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
const UPDATE = 'CHILL_PERSON_UPDATE';
const SEE = 'CHILL_PERSON_SEE';
const STATS = 'CHILL_PERSON_STATS';
const LISTS = 'CHILL_PERSON_LISTS';
/**
*
......@@ -49,7 +50,7 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
protected function getSupportedAttributes()
{
return array(self::CREATE, self::UPDATE, self::SEE, self::STATS);
return array(self::CREATE, self::UPDATE, self::SEE, self::STATS, self::LISTS);
}
protected function getSupportedClasses()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment