mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add specific role for LIST and STAT
This commit is contained in:
parent
1bc93af148
commit
be2edec605
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user