mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Reorganizando menus
This commit is contained in:
@ -15,21 +15,6 @@ $routes->get('/', 'Home::index');
|
|||||||
$routes->get('lang/{locale}', 'Language::index');
|
$routes->get('lang/{locale}', 'Language::index');
|
||||||
$routes->get('viewmode/(:alpha)', 'Viewmode::index/$1');
|
$routes->get('viewmode/(:alpha)', 'Viewmode::index/$1');
|
||||||
|
|
||||||
//API ROUTER ------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
$routes->get('api/', 'Api::index');
|
|
||||||
$routes->get('api/status', 'Api::status');
|
|
||||||
$routes->post('api/signIn', 'Api::signIn');
|
|
||||||
|
|
||||||
//API ROUTER USER ------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
$routes->get('api/user/', 'Api::user/all');
|
|
||||||
$routes->get('api/user/(:segment)', 'Api::user/id/$1');
|
|
||||||
$routes->post('api/user/', 'Api::user/add');
|
|
||||||
$routes->put('api/user/(:segment)', 'Api::user/edit/$1');
|
|
||||||
$routes->delete('api/user/(:segment)', 'Api::user/delete/$1');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
* Route Definitions
|
* Route Definitions
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Config;
|
namespace Config;
|
||||||
|
|
||||||
use CodeIgniter\Config\BaseConfig;
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
class Safekat extends BaseConfig
|
class Safekat extends BaseConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
public $appName = 'ERP Safekat 2.0';
|
public string $appName = 'ERP Safekat 2.0';
|
||||||
public $i18n = 'es-ES';
|
public string $i18n = 'es-ES';
|
||||||
|
|
||||||
|
|
||||||
public $vista_impresion = 'impresion';
|
public $vista_impresion = 'impresion';
|
||||||
public $vista_maquetacion = 'maquetacion';
|
public $vista_maquetacion = 'maquetacion';
|
||||||
public $vista_digitalizacion = 'digitalizacion';
|
public $vista_digitalizacion = 'digitalizacion';
|
||||||
|
|
||||||
public $languages = [
|
public array $languages = [
|
||||||
'en' => 'English',
|
'en' => 'English',
|
||||||
'es' => 'Spanish',
|
'es' => 'Spanish',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public $languageFlags = [
|
public array $languageFlags = [
|
||||||
'en' => 'us',
|
'en' => 'us',
|
||||||
'es' => 'es',
|
'es' => 'es',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,203 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Filters;
|
|
||||||
|
|
||||||
use App\Models\SettingsModel;
|
|
||||||
use CodeIgniter\Filters\FilterInterface;
|
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class LoginAuthFilter implements FilterInterface
|
|
||||||
{
|
|
||||||
public function before(RequestInterface $request, $arguments = null)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
/*if(!$this->validateIgnoreControllerAccess()){
|
|
||||||
$session = session();
|
|
||||||
$token = $session->get('token')??'';
|
|
||||||
$tfa = $session->get('tfa')??false;
|
|
||||||
|
|
||||||
$this->getSettings();
|
|
||||||
|
|
||||||
if (empty($token) || $tfa == true) {
|
|
||||||
return redirect()->to('/login');
|
|
||||||
}else{
|
|
||||||
$this->validateControllerAccess();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
} catch (Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Access to controllers is valid.
|
|
||||||
*/
|
|
||||||
public function validateControllerAccess(){
|
|
||||||
$request = \Config\Services::request();
|
|
||||||
$uri = $request->getUri();
|
|
||||||
|
|
||||||
$language = \Config\Services::language();
|
|
||||||
$language->setLocale(session()->lang);
|
|
||||||
|
|
||||||
$getWhiteList = $this->whiteListController();
|
|
||||||
|
|
||||||
foreach ($getWhiteList as $item){
|
|
||||||
if(strtolower($item) == $uri->getSegment(1)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$getRules = json_decode(session()->get('rules')??'[]');
|
|
||||||
|
|
||||||
foreach ($this->whiteListMethod() as $item){
|
|
||||||
if(strtolower($item) == $uri->getSegment(2)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($getRules as $key=>$value){
|
|
||||||
if(strtolower($key) == $uri->getSegment(1)){
|
|
||||||
if($uri->getTotalSegments() <= 1){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
foreach ($value as $item){
|
|
||||||
if(strtolower($item) == $uri->getSegment(2)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
foreach($this->controllerFolderWhiteList() 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
|
|
||||||
header('Location: /home');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JJO
|
|
||||||
* Returns the controller folder list
|
|
||||||
*/
|
|
||||||
public function controllerFolderWhiteList(){
|
|
||||||
return [
|
|
||||||
'Catalogo',
|
|
||||||
'Clientes',
|
|
||||||
'Compras',
|
|
||||||
'Configuracion',
|
|
||||||
'EnviosLogistica',
|
|
||||||
'Facturacion',
|
|
||||||
'Informes',
|
|
||||||
'Importacion',
|
|
||||||
'Pedidos',
|
|
||||||
'Presupuestos',
|
|
||||||
'Produccion',
|
|
||||||
'Proveedores',
|
|
||||||
'Servicios',
|
|
||||||
'Tarifas',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the white list of allowed controllers.
|
|
||||||
*/
|
|
||||||
public function whiteListController(){
|
|
||||||
return [
|
|
||||||
'Js_loader',
|
|
||||||
'BaseController',
|
|
||||||
'Home',
|
|
||||||
'Login',
|
|
||||||
'Oauth',
|
|
||||||
'Language',
|
|
||||||
'Api',
|
|
||||||
'Cron',
|
|
||||||
'lang',
|
|
||||||
'Ajax',
|
|
||||||
'Integration',
|
|
||||||
'Migrate',
|
|
||||||
'Test',
|
|
||||||
'Viewmode',
|
|
||||||
'GoBaseController',
|
|
||||||
'GoBaseResourceController',
|
|
||||||
'Maquinaspapelesimpresion',
|
|
||||||
'Maquinastarifasimpresion',
|
|
||||||
'Maquinascalles',
|
|
||||||
'My', 'Usuarios', 'Notification' // PARA LA DEMO
|
|
||||||
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the whitelist of public controllers.
|
|
||||||
*/
|
|
||||||
public function ignoreListController(){
|
|
||||||
return [
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function validateIgnoreControllerAccess(){
|
|
||||||
$request = \Config\Services::request();
|
|
||||||
$uri = $request->getUri();
|
|
||||||
|
|
||||||
$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',
|
|
||||||
'allItemsSelect',
|
|
||||||
'menuItems',
|
|
||||||
'datatable',
|
|
||||||
'datatable_editor',
|
|
||||||
'datatable_2',
|
|
||||||
'datatable_editor_2',
|
|
||||||
'collect',
|
|
||||||
'cast',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSettings(){
|
|
||||||
// Get Settings
|
|
||||||
$session = session();
|
|
||||||
$settingsBase = new SettingsModel();
|
|
||||||
$settings = $settingsBase->first()??[];
|
|
||||||
$session->set('settings', $settings);
|
|
||||||
if(empty($session->get('lang'))) {
|
|
||||||
$session->set('lang', $settings['default_language'] ?? 'es');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ $token = $session->get('token') ?? '';
|
|||||||
$tfa = $session->get('tfa') ?? false;
|
$tfa = $session->get('tfa') ?? false;
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
|
||||||
$picture = session()->get('picture');
|
$picture = "/assets/img/default-user.png";
|
||||||
$pulse = session()->get('pulse');
|
$pulse = session()->get('pulse');
|
||||||
$notification = session()->get('notification');
|
$notification = session()->get('notification');
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$session = session();
|
$session = session();
|
||||||
$token = $session->get('token') ?? '';
|
|
||||||
$tfa = $session->get('tfa') ?? false;
|
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
$picture = "/assets/img/default-user.png";
|
||||||
$picture = session()->get('picture');
|
|
||||||
$pulse = session()->get('pulse');
|
|
||||||
$notification = session()->get('notification');
|
|
||||||
|
|
||||||
if (!empty($token) && $tfa == false) {
|
|
||||||
//echo "<script>window.location.href = '/'; </script>";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
@ -31,7 +22,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$session = session();
|
$session = session();
|
||||||
$token = $session->get('token') ?? '';
|
|
||||||
$tfa = $session->get('tfa') ?? false;
|
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
$picture = "/assets/img/default-user.png";
|
||||||
$picture = session()->get('picture');
|
|
||||||
$pulse = session()->get('pulse');
|
|
||||||
$notification = session()->get('notification');
|
|
||||||
|
|
||||||
if (!empty($token) && $tfa == false) {
|
|
||||||
//echo "<script>window.location.href = '/'; </script>";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
@ -31,7 +22,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ $token = $session->get('token') ?? '';
|
|||||||
$tfa = $session->get('tfa') ?? false;
|
$tfa = $session->get('tfa') ?? false;
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
|
||||||
$picture = session()->get('picture');
|
$picture = "/assets/img/default-user.png";
|
||||||
$pulse = session()->get('pulse');
|
$pulse = session()->get('pulse');
|
||||||
$notification = session()->get('notification');
|
$notification = session()->get('notification');
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ $token = $session->get('token') ?? '';
|
|||||||
$tfa = $session->get('tfa') ?? false;
|
$tfa = $session->get('tfa') ?? false;
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
|
||||||
$picture = session()->get('picture');
|
$picture = "/assets/img/default-user.png";
|
||||||
$pulse = session()->get('pulse');
|
$pulse = session()->get('pulse');
|
||||||
$notification = session()->get('notification');
|
$notification = session()->get('notification');
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ $tfa = $session->get('tfa') ?? false;
|
|||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
|
||||||
// Legacy TODO: check?
|
// Legacy TODO: check?
|
||||||
$picture = session()->get('picture');
|
$picture = "/assets/img/default-user.png";
|
||||||
$pulse = session()->get('pulse');
|
$pulse = session()->get('pulse');
|
||||||
$notification = session()->get('notification');
|
$notification = session()->get('notification');
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ $token = $session->get('token') ?? '';
|
|||||||
$tfa = $session->get('tfa') ?? false;
|
$tfa = $session->get('tfa') ?? false;
|
||||||
$settings = $session->get('settings');
|
$settings = $session->get('settings');
|
||||||
|
|
||||||
$picture = session()->get('picture');
|
$picture = "/assets/img/default-user.png";
|
||||||
$pulse = session()->get('pulse');
|
$pulse = session()->get('pulse');
|
||||||
$notification = session()->get('notification');
|
$notification = session()->get('notification');
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title'] ?? '' ?></title>
|
<title><?= config('Safekat')->appName ?></title>
|
||||||
|
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$session = session();
|
$session = session();
|
||||||
$viewMode = $session->get('view_mode');
|
$viewMode = $session->get('view_mode');
|
||||||
|
|
||||||
if ($viewMode == config("Basics")->vista_maquetacion) {
|
switch ($viewMode) {
|
||||||
|
case config("Safekat")->vista_maquetacion:
|
||||||
include "menu_maquetacion.php";
|
include "menu_maquetacion.php";
|
||||||
|
break;
|
||||||
}
|
case config("Safekat")->vista_digitalizacion:
|
||||||
else if ($viewMode == config("Basics")->vista_digitalizacion) {
|
include "menu_digitalizacion.php";
|
||||||
|
break;
|
||||||
include "menu_digitalizacion.php";
|
default:
|
||||||
|
include "menu_impresion.php";
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
include "menu_impresion.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user