mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Testeando controlador clientes
This commit is contained in:
12
.vscode/sftp.json
vendored
Normal file
12
.vscode/sftp.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "sk-jjo",
|
||||||
|
"host": "sk-jjo.imnavajas.es",
|
||||||
|
"protocol": "ftp",
|
||||||
|
"port": 21,
|
||||||
|
"username": "sk-jjo",
|
||||||
|
"password": "yuh1C^290",
|
||||||
|
"remotePath": "/",
|
||||||
|
"uploadOnSave": true,
|
||||||
|
"useTempFile": false,
|
||||||
|
"openSsh": false
|
||||||
|
}
|
||||||
2
ci4/.env
2
ci4/.env
@ -22,7 +22,7 @@ CI_ENVIRONMENT = development
|
|||||||
# APP
|
# APP
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
app.baseURL = 'http://safekat.test'
|
app.baseURL = 'https://sk-jjo.imnavajas.es'
|
||||||
# app.forceGlobalSecureRequests = false
|
# app.forceGlobalSecureRequests = false
|
||||||
|
|
||||||
# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
|
# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
|
||||||
|
|||||||
19
ci4/app/Controllers/Impresion/Clientes.php
Normal file
19
ci4/app/Controllers/Impresion/Clientes.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Impresion;
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
class Clientes extends BaseController
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,85 +2,71 @@
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\UserModel;
|
|
||||||
use App\Models\UserGroupModel;
|
|
||||||
use App\Models\GroupUserModel;
|
|
||||||
|
|
||||||
class Test extends BaseController
|
class Test extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
private $user_model;
|
|
||||||
private $group_user_model;
|
|
||||||
private $group_model;
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->user_model = new UserModel();
|
|
||||||
$this->group_user_model = new GroupUserModel();
|
|
||||||
$this->group_model = new UserGroupModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
/////////////////////////////////7
|
try {
|
||||||
// Join groups access rules
|
helper('filesystem');
|
||||||
/*$user_token = "a4a60f9f064218b09cf108418e585507";
|
helper('directory');
|
||||||
$groups = $this->group_user_model
|
if(strtolower(PHP_OS) == 'linux'){
|
||||||
->select('token_group')
|
$compatibility = '/';
|
||||||
->where('token_user', $user_token)->findAll();
|
}else{
|
||||||
|
$compatibility = '\\';
|
||||||
if(sizeof($groups)>0){
|
}
|
||||||
$rules = html_entity_decode($this->group_model->select('rules')->where('token',$groups[0]['token_group'])->first()['rules']);
|
|
||||||
|
if(empty($controller)){
|
||||||
|
$map = directory_map(APPPATH.'Controllers');
|
||||||
|
foreach ($map as $key=>$item)
|
||||||
|
{
|
||||||
|
if(!strpos(strtolower($key),$compatibility)){
|
||||||
|
var_dump($key);
|
||||||
|
$name = str_replace('.php', '', $item);
|
||||||
|
if(!getIgnoreController($name)){
|
||||||
|
$controllers[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'path' => '',
|
||||||
|
'methods' => get_class_methods('App\Controllers\\'.$name)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
foreach ($item as $subitem){
|
||||||
|
$name = str_replace('.php', '', $subitem);
|
||||||
|
if(!getIgnoreController($name)) {
|
||||||
|
$controllers[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'path' => $key,
|
||||||
|
'methods' => get_class_methods('App\Controllers\\' . str_replace('/', '\\', $key) . $name)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$array = explode('/',$controller);
|
||||||
|
$dir = count($array) > 1 ? $array[0] : '';
|
||||||
|
$name = count($array) > 1 ? '\\'.$array[1] : $array[0];
|
||||||
|
$controllers[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'path' => $dir,
|
||||||
|
'methods' => get_class_methods('App\Controllers\\'.str_replace('/','\\',$dir).$name)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/*echo '<pre>';
|
||||||
|
var_dump($controllers);
|
||||||
|
echo '<pre>';
|
||||||
|
dd();
|
||||||
|
*/
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
for ($i = 1; $i<sizeof($groups); $i++) {
|
|
||||||
echo var_dump($this->group_model->select('rules')->where('token',$groups[$i]['token_group'])->first()['rules']);
|
|
||||||
$rules = json_encode(
|
|
||||||
array_merge(
|
|
||||||
json_decode($rules, true),
|
|
||||||
json_decode($this->group_model->select('rules')->where('token',$groups[$i]['token_group'])->first()['rules'], true)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} */
|
|
||||||
|
|
||||||
$user_token = 'c0bf18621f78cb2ffc4a67cf8d5173c7';
|
|
||||||
$groups_token = $this->group_user_model->select('token_group')
|
|
||||||
->where('token_user',$user_token)
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
$groups_names = [];
|
|
||||||
foreach($groups_token as $g_t){
|
|
||||||
$title = $this->group_model->select('title')
|
|
||||||
->where('token',$g_t)
|
|
||||||
->first()['title'];
|
|
||||||
array_push($groups_names, $title);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<pre>';
|
|
||||||
var_dump($groups_names);
|
|
||||||
echo '</pre>';
|
|
||||||
|
|
||||||
dd();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Total number of records without filtering
|
|
||||||
$totalRecords = $this->user_model->select('id_user')
|
|
||||||
->join('auth_user_group','auth_user_group.token = auth_user.group')
|
|
||||||
->countAllResults();
|
|
||||||
|
|
||||||
//Total number of records with filtering
|
|
||||||
$totalRecordwithFilter = $this->user_model->select('id_user')
|
|
||||||
->join('auth_user_group','auth_user_group.token = auth_user.group')
|
|
||||||
->orLike('first_name', $searchValue)
|
|
||||||
->orLike('email', $searchValue)
|
|
||||||
->countAllResults();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
$language->setLocale(session()->lang);
|
$language->setLocale(session()->lang);
|
||||||
|
|
||||||
$getWhiteList = $this->whiteListController();
|
$getWhiteList = $this->whiteListController();
|
||||||
|
|
||||||
foreach ($getWhiteList as $item){
|
foreach ($getWhiteList as $item){
|
||||||
if(strtolower($item) == $uri->getSegment(1)){
|
if(strtolower($item) == $uri->getSegment(1)){
|
||||||
return true;
|
return true;
|
||||||
@ -83,6 +84,8 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
public function whiteListController(){
|
public function whiteListController(){
|
||||||
return [
|
return [
|
||||||
'',
|
'',
|
||||||
|
'Clientes',
|
||||||
|
|
||||||
'BaseController',
|
'BaseController',
|
||||||
'Home',
|
'Home',
|
||||||
'Login',
|
'Login',
|
||||||
@ -94,7 +97,8 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
'Ajax',
|
'Ajax',
|
||||||
'Integration',
|
'Integration',
|
||||||
'Migrate',
|
'Migrate',
|
||||||
'Test'
|
'Test',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user