setLocale(session()->lang); $getWhiteList = $this->whiteListController(); foreach ($getWhiteList as $item){ if(strtolower($item) == $uri->getSegment(1)){ echo '
';
                var_dump('1');
                echo '
'; dd(); return true; } } $getRules = json_decode(session()->get('rules')??'[]'); foreach ($this->whiteListMethod() as $item){ if(strtolower($item) == $uri->getSegment(2)){ echo '
';
                var_dump('2');
                echo '
'; dd(); return true; } } foreach ($getRules as $key=>$value){ if(strtolower($key) == $uri->getSegment(1)){ if($uri->getTotalSegments() <= 1){ echo '
';
                    var_dump('3');
                    echo '
'; dd(); return true; } foreach ($value as $item){ if(strtolower($item) == $uri->getSegment(2)){ echo '
';
                        var_dump('4');
                        echo '
'; dd(); return true; } } } else{ foreach($this->controllerFolderList() as $folder){ if(strtolower($folder) == $uri->getSegment(1)){ var_dump($key); if(strtolower($key) == $uri->getSegment(2)){ if($uri->getTotalSegments() <= 2){ echo '
';
                                var_dump('5');
                                echo '
'; dd(); return true; } foreach ($value as $item){ if(strtolower($item) == $uri->getSegment(3)){ echo '
';
                                    var_dump('6');
                                    echo '
'; dd(); return true; } } } } } } } echo '
';
        var_dump($uri->getSegment(1));
        var_dump($uri->getSegment(2));
        var_dump($uri->getSegment(3));
        echo '
'; dd(); } /** * Returns the white list of allowed controllers. */ public function whiteListController(){ return [ '', 'BaseController', 'Home', 'Login', 'Oauth', 'Language', 'Api', 'Cron', 'lang', 'Ajax', 'Integration', 'Migrate', 'Test', ]; } /** * JJO * Returns the controller folder list */ public function controllerFolderList(){ return [ 'impresion', ]; } /** * Returns the whitelist of public controllers. */ public function ignoreListController(){ return [ ]; } public function validateIgnoreControllerAccess(){ $request = \Config\Services::request(); $uri = $request->uri; $getList = $this->ignoreListController(); foreach ($getList as $item){ if(strtolower($item) == $uri->getSegment(1)){ return true; } } return false; } public function whiteListMethod(){ return [ 'initController', '__construct', 'validateControllerAccess', 'whiteListController', 'whiteListMethod' ]; } }