mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Empezando a trabajar en menus
This commit is contained in:
@ -156,9 +156,11 @@ class Group extends BaseController
|
|||||||
$exp = explode('_',$key);
|
$exp = explode('_',$key);
|
||||||
$controller[] = $exp[0];
|
$controller[] = $exp[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($controller != null){
|
if($controller != null){
|
||||||
foreach (array_unique($controller) as $item){
|
foreach (array_unique($controller) as $item){
|
||||||
$rules_access[$item] = [];
|
$rules_access[$item] = [];
|
||||||
|
|
||||||
foreach ($getChecked as $key=>$value){
|
foreach ($getChecked as $key=>$value){
|
||||||
$exp = explode('_',$key);
|
$exp = explode('_',$key);
|
||||||
if($exp[0] == $item){
|
if($exp[0] == $item){
|
||||||
@ -168,7 +170,9 @@ class Group extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$listPost['rules'] = json_encode($rules_access??'{}');
|
$listPost['rules'] = json_encode($rules_access??'{}');
|
||||||
|
|
||||||
if(empty($listPost['id_group'])){
|
if(empty($listPost['id_group'])){
|
||||||
$listPost['token'] = md5(uniqid(rand(), true));
|
$listPost['token'] = md5(uniqid(rand(), true));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace App\Controllers\Impresion;
|
|||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
|
||||||
class Cliente extends BaseController
|
class Impresioncliente extends BaseController
|
||||||
{
|
{
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@ -13,8 +13,8 @@ class Cliente extends BaseController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
echo 'Hola2';
|
echo 'Hola2';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers;
|
|
||||||
use App\Controllers\BaseController;
|
|
||||||
|
|
||||||
class Tarifas extends BaseController
|
|
||||||
{
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
|
|
||||||
echo 'Hola';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -14,7 +14,8 @@ class Test extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$request = \Config\Services::request();
|
$request = \Config\Services::request();
|
||||||
$uri = 'https://sk-jjo.imnavajas.es/tarifas';
|
$uri = new \CodeIgniter\HTTP\URI('https://sk-jjo.imnavajas.es/impresion/impresioncliente');
|
||||||
|
|
||||||
|
|
||||||
$language = \Config\Services::language();
|
$language = \Config\Services::language();
|
||||||
$language->setLocale(session()->lang);
|
$language->setLocale(session()->lang);
|
||||||
@ -23,6 +24,13 @@ class Test extends BaseController
|
|||||||
|
|
||||||
foreach ($getWhiteList as $item){
|
foreach ($getWhiteList as $item){
|
||||||
if(strtolower($item) == $uri->getSegment(1)){
|
if(strtolower($item) == $uri->getSegment(1)){
|
||||||
|
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump('1');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,6 +39,12 @@ class Test extends BaseController
|
|||||||
|
|
||||||
foreach ($this->whiteListMethod() as $item){
|
foreach ($this->whiteListMethod() as $item){
|
||||||
if(strtolower($item) == $uri->getSegment(2)){
|
if(strtolower($item) == $uri->getSegment(2)){
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump('2');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,24 +52,68 @@ class Test extends BaseController
|
|||||||
foreach ($getRules as $key=>$value){
|
foreach ($getRules as $key=>$value){
|
||||||
if(strtolower($key) == $uri->getSegment(1)){
|
if(strtolower($key) == $uri->getSegment(1)){
|
||||||
if($uri->getTotalSegments() <= 1){
|
if($uri->getTotalSegments() <= 1){
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump('3');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($value as $item){
|
foreach ($value as $item){
|
||||||
if(strtolower($item) == $uri->getSegment(2)){
|
if(strtolower($item) == $uri->getSegment(2)){
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump('4');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
return true;
|
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 '<pre>';
|
||||||
|
var_dump('5');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($value as $item){
|
||||||
|
if(strtolower($item) == $uri->getSegment(3)){
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump('6');
|
||||||
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
|
|
||||||
header('Location: /home');
|
|
||||||
exit();
|
|
||||||
|
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
var_dump($controllers);
|
var_dump($uri->getSegment(1));
|
||||||
|
var_dump($uri->getSegment(2));
|
||||||
|
var_dump($uri->getSegment(3));
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
|
dd();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,4 +139,46 @@ class Test extends BaseController
|
|||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,22 +66,33 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
if($uri->getTotalSegments() <= 1){
|
if($uri->getTotalSegments() <= 1){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
echo '<pre>';
|
|
||||||
var_dump($value);
|
|
||||||
/*var_dump($uri->getSegment(0));
|
|
||||||
var_dump($uri->getSegment(1));
|
|
||||||
var_dump($uri->getSegment(2));
|
|
||||||
var_dump($uri->getTotalSegments());*/
|
|
||||||
echo '</pre>';
|
|
||||||
|
|
||||||
/*foreach ($value as $item){
|
foreach ($value as $item){
|
||||||
if(strtolower($item) == $uri->getSegment(2)){
|
if(strtolower($item) == $uri->getSegment(2)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
foreach($this->controllerFolderList() as $folder){
|
||||||
|
if(strtolower($folder) == $uri->getSegment(1)){
|
||||||
|
if(strtolower($key) == $uri->getSegment(2)){
|
||||||
|
if($uri->getTotalSegments() <= 2){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($value as $item){
|
||||||
|
if(strtolower($item) == $uri->getSegment(3)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
dd();
|
|
||||||
}
|
}
|
||||||
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
|
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
|
||||||
header('Location: /home');
|
header('Location: /home');
|
||||||
@ -110,6 +121,17 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JJO
|
||||||
|
* Returns the controller folder list
|
||||||
|
*/
|
||||||
|
public function controllerFolderList(){
|
||||||
|
return [
|
||||||
|
'impresion',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the whitelist of public controllers.
|
* Returns the whitelist of public controllers.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -156,7 +156,7 @@ function getDictionary($word=''){
|
|||||||
'oauth_store' => lang("App.group_rules_label_oauth_store"),
|
'oauth_store' => lang("App.group_rules_label_oauth_store"),
|
||||||
'template_store' => lang("App.group_rules_label_template_store"),
|
'template_store' => lang("App.group_rules_label_template_store"),
|
||||||
'Tarifas' => 'Tarifas',
|
'Tarifas' => 'Tarifas',
|
||||||
'Cliente' => 'Cliente'
|
'ImpresionCliente' => 'Cliente'
|
||||||
];
|
];
|
||||||
return array_key_exists($word,$dictionary)?$dictionary[$word] : $word;
|
return array_key_exists($word,$dictionary)?$dictionary[$word] : $word;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user