mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add a role for stats, apply role on export
This commit is contained in:
parent
d81b2e1037
commit
5b3bd6545a
@ -8,6 +8,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
use Symfony\Component\DependencyInjection\Loader;
|
use Symfony\Component\DependencyInjection\Loader;
|
||||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||||
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the class that loads and manages your bundle configuration
|
* This is the class that loads and manages your bundle configuration
|
||||||
@ -84,7 +85,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
$container->prependExtensionConfig('security', array(
|
$container->prependExtensionConfig('security', array(
|
||||||
'role_hierarchy' => array(
|
'role_hierarchy' => array(
|
||||||
'CHILL_PERSON_UPDATE' => array('CHILL_PERSON_SEE'),
|
'CHILL_PERSON_UPDATE' => array('CHILL_PERSON_SEE'),
|
||||||
'CHILL_PERSON_CREATE' => array('CHILL_PERSON_SEE')
|
'CHILL_PERSON_CREATE' => array('CHILL_PERSON_SEE'),
|
||||||
|
'CHILL_PERSON_SEE' => array(PersonVoter::STATS)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ use Chill\MainBundle\Export\ExportInterface;
|
|||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -49,6 +51,11 @@ class CountPerson implements ExportInterface
|
|||||||
return "Count persons";
|
return "Count persons";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function requiredRole()
|
||||||
|
{
|
||||||
|
return new Role(PersonVoter::STATS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiate the query
|
* Initiate the query
|
||||||
*
|
*
|
||||||
|
@ -34,6 +34,7 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleInterface
|
|||||||
const CREATE = 'CHILL_PERSON_CREATE';
|
const CREATE = 'CHILL_PERSON_CREATE';
|
||||||
const UPDATE = 'CHILL_PERSON_UPDATE';
|
const UPDATE = 'CHILL_PERSON_UPDATE';
|
||||||
const SEE = 'CHILL_PERSON_SEE';
|
const SEE = 'CHILL_PERSON_SEE';
|
||||||
|
const STATS = 'CHILL_PERSON_STATS';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user