This commit is contained in:
afornerot 2019-06-17 17:39:18 +02:00
parent fdbccaed08
commit 047652dded
2 changed files with 24 additions and 2 deletions

View File

@ -138,6 +138,30 @@ class ConfigController extends Controller
return $config;
}
public function permmodoAction()
{
$em = $this->getDoctrine()->getManager();
$sidebars=$this->get('session')->get('sidebar');
$perms=[];
foreach($sidebars as $sidebar) {
foreach($sidebar["childs"] as $child) {
$permmod=$em->getRepository("CadolesCoreBundle:PermModo")->findOneBy(["route"=>$child["path"]]);
if($permmod) {
array_push($perms,['label'=>$sidebar['label'].' >> '.$child['label'],'visible'=>$permmod->getVisible()]);
}
}
}
return $this->render('CadolesCoreBundle:Config:permmodo.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'permmodos' => $perms
]);
}
protected function getErrorForm($form,$request,$data) {
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();

View File

@ -113,7 +113,6 @@
$request = $event->getRequest();
$route = $request->attributes->get('_route');
if($route!="cadoles_core_config"&&stripos($route,"_config")!==false) {
error_log($route);
if(stripos($route,"cadoles_core_config_logo")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_core_config_header")!==false) $route="cadoles_portal_config_page";
@ -133,7 +132,6 @@
$route.=(isset($tbroute[1])?"_".$tbroute[1]:"");
$route.=(isset($tbroute[2])?"_".$tbroute[2]:"");
$route.=(isset($tbroute[3])?"_".$tbroute[3]:"");
error_log($route);
$permmodo = $this->em->getRepository("CadolesCoreBundle:PermModo")->findOneBy(['route'=> $route, "visible"=>true]);
if(!$permmodo) die('Permission denied');