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")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function indexAction() {
|
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',
|
return $this->render( 'festival/index.html.twig',
|
||||||
[
|
[
|
||||||
|
|
|
@ -21,7 +21,6 @@ class ProductCategoryController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function indexAction() {
|
public function indexAction() {
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$currentUser = $this->getUser();
|
$currentUser = $this->getUser();
|
||||||
$productCategories = $currentUser->getCategories();
|
$productCategories = $currentUser->getCategories();
|
||||||
|
@ -69,6 +68,9 @@ class ProductCategoryController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function showAction( ProductCategory $productCategory ) {
|
public function showAction( ProductCategory $productCategory ) {
|
||||||
|
if ( $productCategory->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||||
|
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||||
|
}
|
||||||
$deleteForm = $this->createDeleteForm( $productCategory );
|
$deleteForm = $this->createDeleteForm( $productCategory );
|
||||||
|
|
||||||
return $this->render( 'productcategory/show.html.twig',
|
return $this->render( 'productcategory/show.html.twig',
|
||||||
|
|
|
@ -21,9 +21,8 @@ class ProductController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function indexAction() {
|
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',
|
return $this->render( 'product/index.html.twig',
|
||||||
[
|
[
|
||||||
|
@ -65,6 +64,9 @@ class ProductController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function showAction( Product $product ) {
|
public function showAction( Product $product ) {
|
||||||
|
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||||
|
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||||
|
}
|
||||||
$deleteForm = $this->createDeleteForm( $product );
|
$deleteForm = $this->createDeleteForm( $product );
|
||||||
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
|
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,8 @@ class SellRecordController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function indexAction() {
|
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',
|
return $this->render( 'sellrecord/index.html.twig',
|
||||||
[
|
[
|
||||||
|
@ -65,6 +64,9 @@ class SellRecordController extends Controller {
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
*/
|
*/
|
||||||
public function showAction( SellRecord $sellRecord ) {
|
public function showAction( SellRecord $sellRecord ) {
|
||||||
|
if ( $sellRecord->getUser()->getId() !== $this->getUser()->getId() ) {
|
||||||
|
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||||
|
}
|
||||||
$deleteForm = $this->createDeleteForm( $sellRecord );
|
$deleteForm = $this->createDeleteForm( $sellRecord );
|
||||||
if ( ! $sellRecord->getUser() == $this->getUser()->getId() ) {
|
if ( ! $sellRecord->getUser() == $this->getUser()->getId() ) {
|
||||||
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
|
||||||
|
|
Loading…
Reference in New Issue