separate things of user in forms
This commit is contained in:
parent
19144377fe
commit
3159adcdca
|
@ -21,9 +21,8 @@ class FestivalController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction() {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$festivals = $em->getRepository( 'AppBundle:Festival' )->findByUser( $this->getUser() );
|
||||
$festivals = $this->getUser()->getFestivals();
|
||||
|
||||
return $this->render( 'festival/index.html.twig',
|
||||
[
|
||||
|
|
|
@ -21,7 +21,6 @@ class ProductCategoryController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction() {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$currentUser = $this->getUser();
|
||||
$productCategories = $currentUser->getCategories();
|
||||
|
@ -69,6 +68,9 @@ class ProductCategoryController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function showAction( ProductCategory $productCategory ) {
|
||||
if ( $productCategory->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||
}
|
||||
$deleteForm = $this->createDeleteForm( $productCategory );
|
||||
|
||||
return $this->render( 'productcategory/show.html.twig',
|
||||
|
|
|
@ -21,9 +21,8 @@ class ProductController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction() {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$products = $em->getRepository( 'AppBundle:Product' )->findByUser( $this->getUser() );
|
||||
$products = $this->getUser()->getProducts();
|
||||
|
||||
return $this->render( 'product/index.html.twig',
|
||||
[
|
||||
|
@ -65,6 +64,9 @@ class ProductController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function showAction( Product $product ) {
|
||||
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||
}
|
||||
$deleteForm = $this->createDeleteForm( $product );
|
||||
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||
|
||||
|
|
|
@ -21,9 +21,8 @@ class SellRecordController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction() {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$sellRecords = $em->getRepository( 'AppBundle:SellRecord' )->findByUser( $this->getUser() );
|
||||
$sellRecords = $this->getUser()->getProductsSold();
|
||||
|
||||
return $this->render( 'sellrecord/index.html.twig',
|
||||
[
|
||||
|
@ -65,6 +64,9 @@ class SellRecordController extends Controller {
|
|||
* @Method("GET")
|
||||
*/
|
||||
public function showAction( SellRecord $sellRecord ) {
|
||||
if ( $sellRecord->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||
}
|
||||
$deleteForm = $this->createDeleteForm( $sellRecord );
|
||||
if ( ! $sellRecord->getUser() == $this->getUser()->getId() ) {
|
||||
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||
|
|
Loading…
Reference in New Issue