mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Permisos agrupados
This commit is contained in:
@ -41,7 +41,7 @@ class LoginAuthFilter implements FilterInterface
|
||||
public function validateControllerAccess(){
|
||||
$request = \Config\Services::request();
|
||||
$uri = $request->uri;
|
||||
|
||||
|
||||
$language = \Config\Services::language();
|
||||
$language->setLocale(session()->lang);
|
||||
|
||||
@ -66,16 +66,14 @@ class LoginAuthFilter implements FilterInterface
|
||||
if($uri->getTotalSegments() <= 1){
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($value as $item){
|
||||
if(strtolower($item) == $uri->getSegment(2)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
foreach($this->controllerFolderList() as $folder){
|
||||
foreach($this->controllerFolderWhiteList() as $folder){
|
||||
if(strtolower($folder) == $uri->getSegment(1)){
|
||||
if(strtolower($key) == $uri->getSegment(2)){
|
||||
if($uri->getTotalSegments() <= 2){
|
||||
@ -93,12 +91,36 @@ class LoginAuthFilter implements FilterInterface
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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',
|
||||
'Configuracion',
|
||||
'Digitalizacion',
|
||||
'Facturacion',
|
||||
'Informes',
|
||||
'Logistica',
|
||||
'Pedidos',
|
||||
'Presupuestos',
|
||||
'Produccion',
|
||||
'Proveedores',
|
||||
'Tarifas',
|
||||
'Usuarios',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the white list of allowed controllers.
|
||||
*/
|
||||
@ -121,17 +143,6 @@ class LoginAuthFilter implements FilterInterface
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* JJO
|
||||
* Returns the controller folder list
|
||||
*/
|
||||
public function controllerFolderList(){
|
||||
return [
|
||||
'impresion',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the whitelist of public controllers.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user