mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 13:54:59 +00:00
improve CRUD and switch to symfony3
This commit is contained in:
@@ -11,6 +11,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/{person}/document")
|
||||
@@ -30,11 +32,11 @@ class DocumentPersonController extends Controller
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
||||
->getReachableScopes(
|
||||
$this->getUser(), new Role('CHILL_PERSON_DOCUMENT_SEE'),
|
||||
$this->getUser(), new Role(PersonDocumentVoter::SEE),
|
||||
$person->getCenter());
|
||||
|
||||
$documents = $em
|
||||
@@ -61,11 +63,10 @@ class DocumentPersonController extends Controller
|
||||
throw $this->createNotFoundException('person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$document = new PersonDocument();
|
||||
$document->setUser($user);
|
||||
$document->setUser($this->getUser());
|
||||
$document->setPerson($person);
|
||||
$document->setDate(new \DateTime('Now'));
|
||||
|
||||
@@ -115,8 +116,7 @@ class DocumentPersonController extends Controller
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_DOCUMENT_UPDATE', $document);
|
||||
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$document->setUser($user);
|
||||
$document->setUser($this->getUser());
|
||||
$document->setDate(new \DateTime('Now'));
|
||||
|
||||
$form = $this->createForm(
|
||||
|
Reference in New Issue
Block a user