mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
FIX [voter][household] only allow editing of household if user has chill_person_household_edit right linked to being able to edit persons
This commit is contained in:
@@ -24,6 +24,7 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
@@ -123,7 +124,9 @@ class HouseholdController extends AbstractController
|
||||
*/
|
||||
public function addressEdit(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
if (!$this->security->isGranted(HouseholdVoter::EDIT, $household)) {
|
||||
throw new AccessDeniedException('You are not allowed to edit a household address');
|
||||
}
|
||||
|
||||
$address_id = $request->query->get('address_id');
|
||||
$address = $this->getDoctrine()->getManager()
|
||||
@@ -149,7 +152,9 @@ class HouseholdController extends AbstractController
|
||||
*/
|
||||
public function addresses(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) {
|
||||
throw new AccessDeniedException('You have no access to this household\'s details');
|
||||
}
|
||||
|
||||
//TODO put these lines into a validator constraint on household->getAddress
|
||||
$addresses = $household->getAddresses();
|
||||
@@ -179,7 +184,9 @@ class HouseholdController extends AbstractController
|
||||
*/
|
||||
public function addressMove(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
if (!$this->security->isGranted(HouseholdVoter::EDIT, $household)) {
|
||||
throw new AccessDeniedException('You are not allowed to edit this household');
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'@ChillPerson/Household/address_move.html.twig',
|
||||
@@ -255,7 +262,10 @@ class HouseholdController extends AbstractController
|
||||
*/
|
||||
public function editHouseholdMetadata(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
if (!$this->security->isGranted(HouseholdVoter::EDIT, $household)) {
|
||||
throw new AccessDeniedException('not allowed to edit a household');
|
||||
}
|
||||
|
||||
$form = $this->createMetadataForm($household);
|
||||
|
||||
$form->handleRequest($request);
|
||||
@@ -311,7 +321,9 @@ class HouseholdController extends AbstractController
|
||||
*/
|
||||
public function summary(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) {
|
||||
throw new AccessDeniedException('not allowed to edit a household');
|
||||
}
|
||||
|
||||
$positions = $this->positionRepository
|
||||
->findByActiveOrdered();
|
||||
|
Reference in New Issue
Block a user