Bitácoras
This commit is contained in:
@@ -24,6 +24,10 @@ function sistema()
|
||||
ORDER BY fecha DESC";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
$registros[] = $row;
|
||||
@@ -34,6 +38,66 @@ function sistema()
|
||||
|
||||
function sistemaAgencia()
|
||||
{
|
||||
if (!isset($_SESSION['usuario_id']) || !in_array($_SESSION['tipo_usuario'], ['admin_agencia', 'agente_aduanal'])) {
|
||||
header('Location: /IMPORTADORES/login');
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$id_usuario = $_SESSION['usuario_id'];
|
||||
|
||||
// Obtener ID de agencia asociada
|
||||
$sql_agencia = "SELECT id_agencia FROM agente_agencia WHERE id_agente = ? AND activo = 1";
|
||||
$stmt_agencia = sqlsrv_query($conn, $sql_agencia, [$id_usuario]);
|
||||
|
||||
$id_agencia = null;
|
||||
if ($stmt_agencia && ($row = sqlsrv_fetch_array($stmt_agencia, SQLSRV_FETCH_ASSOC))) {
|
||||
$id_agencia = $row['id_agencia'];
|
||||
}
|
||||
|
||||
if (!$id_agencia) {
|
||||
die("⚠️ No se encontró una agencia activa asociada al usuario.");
|
||||
}
|
||||
|
||||
// Obtener todos los usuarios ligados a la misma agencia (agentes + importadores)
|
||||
$sql_usuarios = "
|
||||
SELECT DISTINCT id_usuario FROM usuarios_sistema
|
||||
WHERE id_usuario IN (
|
||||
SELECT id_agente FROM agente_agencia WHERE id_agencia = ? AND activo = 1
|
||||
UNION
|
||||
SELECT id_importador FROM importador_agencia WHERE id_agencia = ? AND activo = 1
|
||||
)
|
||||
";
|
||||
$stmt_usuarios = sqlsrv_query($conn, $sql_usuarios, [$id_agencia, $id_agencia]);
|
||||
|
||||
$usuarios = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt_usuarios, SQLSRV_FETCH_ASSOC)) {
|
||||
$usuarios[] = $row['id_usuario'];
|
||||
}
|
||||
|
||||
// Consultar bitácora solo si hay usuarios ligados
|
||||
$registros = [];
|
||||
if (!empty($usuarios)) {
|
||||
$placeholders = implode(',', array_fill(0, count($usuarios), '?'));
|
||||
|
||||
$sql_bitacora = "
|
||||
SELECT bl.*, u.nombre
|
||||
FROM bitacora_login bl
|
||||
INNER JOIN usuarios_sistema u ON bl.id_usuario = u.id_usuario
|
||||
WHERE bl.id_usuario IN ($placeholders)
|
||||
ORDER BY fecha DESC
|
||||
";
|
||||
|
||||
$stmt = sqlsrv_query($conn, $sql_bitacora, $usuarios);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
$registros[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
include __DIR__ . '/../../views/bitacoras/sistema_agencia.php';
|
||||
}
|
||||
@@ -46,9 +110,13 @@ function usuarios()
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$sql = "SELECT * FROM bitacora_usuarios ORDER BY fecha DESC";
|
||||
$sql = "SELECT * FROM bitacora_usuarios ORDER BY fecha DESC";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
$registros[] = $row;
|
||||
@@ -59,11 +127,106 @@ function usuarios()
|
||||
|
||||
function vinculaciones()
|
||||
{
|
||||
if (!isset($_SESSION['usuario_id']) || !in_array($_SESSION['tipo_usuario'], ['admin_agencia', 'agente_aduanal'])) {
|
||||
header('Location: /IMPORTADORES/login');
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$usuario_id = $_SESSION['usuario_id'];
|
||||
|
||||
// 1. Obtener la agencia asociada al usuario actual
|
||||
$sql_agencia = "SELECT id_agencia FROM agente_agencia WHERE id_agente = ? AND activo = 1";
|
||||
$stmt_agencia = sqlsrv_query($conn, $sql_agencia, [$usuario_id]);
|
||||
|
||||
$id_agencia = null;
|
||||
if ($stmt_agencia && ($row = sqlsrv_fetch_array($stmt_agencia, SQLSRV_FETCH_ASSOC))) {
|
||||
$id_agencia = $row['id_agencia'];
|
||||
}
|
||||
|
||||
if (!$id_agencia) {
|
||||
die("⚠️ No se encontró una agencia activa asociada al usuario.");
|
||||
}
|
||||
|
||||
// 2. Consulta de vinculaciones SOLO de esa agencia
|
||||
$sql = "
|
||||
SELECT ia.*,
|
||||
u.nombre AS nombre_importador,
|
||||
aa.nombre_agencia,
|
||||
ap.nombre AS nombre_aprobador
|
||||
FROM importador_agencia ia
|
||||
INNER JOIN usuarios_sistema u ON ia.id_importador = u.id_usuario
|
||||
INNER JOIN agencias_aduanales aa ON ia.id_agencia = aa.id_agencia
|
||||
LEFT JOIN usuarios_sistema ap ON ia.aprobado_por = ap.id_usuario
|
||||
WHERE ia.id_agencia = ?
|
||||
ORDER BY ia.fecha_vinculacion DESC
|
||||
";
|
||||
|
||||
$stmt = sqlsrv_query($conn, $sql, [$id_agencia]);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
if ($row['fecha_desvinculacion'] !== null) {
|
||||
$row['accion'] = 'Desvinculación';
|
||||
$row['fecha'] = $row['fecha_desvinculacion'];
|
||||
} else {
|
||||
$row['accion'] = 'Vinculación';
|
||||
$row['fecha'] = $row['fecha_vinculacion'];
|
||||
}
|
||||
$registros[] = $row;
|
||||
}
|
||||
|
||||
include __DIR__ . '/../../views/bitacoras/bitacora_vinculaciones.php';
|
||||
}
|
||||
|
||||
function vinculacionesUsuario()
|
||||
{
|
||||
if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador') {
|
||||
header('Location: /IMPORTADORES/login');
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$id_importador = $_SESSION['usuario_id'];
|
||||
|
||||
// Traer todas las relaciones del importador actual
|
||||
$sql = "
|
||||
SELECT ia.*,
|
||||
u.nombre AS nombre_importador,
|
||||
aa.nombre_agencia,
|
||||
ap.nombre AS nombre_aprobador
|
||||
FROM importador_agencia ia
|
||||
INNER JOIN usuarios_sistema u ON ia.id_importador = u.id_usuario
|
||||
INNER JOIN agencias_aduanales aa ON ia.id_agencia = aa.id_agencia
|
||||
LEFT JOIN usuarios_sistema ap ON ia.aprobado_por = ap.id_usuario
|
||||
WHERE ia.id_importador = ?
|
||||
ORDER BY ia.fecha_vinculacion DESC
|
||||
";
|
||||
|
||||
$stmt = sqlsrv_query($conn, $sql, [$id_importador]);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
// Determinar tipo de acción
|
||||
if (!empty($row['fecha_desvinculacion'])) {
|
||||
$row['accion'] = 'Desvinculación';
|
||||
$row['fecha'] = $row['fecha_desvinculacion'];
|
||||
} else {
|
||||
$row['accion'] = 'Vinculación';
|
||||
$row['fecha'] = $row['fecha_vinculacion'];
|
||||
}
|
||||
|
||||
$registros[] = $row;
|
||||
}
|
||||
|
||||
include __DIR__ . '/../../views/bitacoras/vinculaciones_usuario.php';
|
||||
}
|
||||
|
||||
@@ -75,13 +238,19 @@ function agencias()
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$sql = "SELECT ba.*, u.nombre
|
||||
FROM bitacora_login ba
|
||||
$sql = "SELECT ba.*, aa.nombre_agencia, u.nombre
|
||||
FROM bitacora_agencias ba
|
||||
INNER JOIN agencias_aduanales aa
|
||||
ON ba.id_agencia = aa.id_agencia
|
||||
INNER JOIN usuarios_sistema u
|
||||
ON bl.id_usuario = u.id_usuario
|
||||
ON ba.realizado_por = u.id_usuario
|
||||
ORDER BY fecha DESC";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
$registros[] = $row;
|
||||
@@ -97,21 +266,24 @@ function miAcceso()
|
||||
}
|
||||
|
||||
$conn = getConnection();
|
||||
$id_usuario = $_SESSION['usuario_id'];
|
||||
|
||||
$sql = "SELECT id_bitacora, usuario_id, accion, descripcion, fecha FROM bitacora_usuarios ORDER BY fecha DESC";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
$sql = "SELECT bl.id, bl.id_usuario, bl.email, bl.ip, bl.fecha, bl.exito, bl.detalle, u.nombre
|
||||
FROM bitacora_login bl
|
||||
INNER JOIN usuarios_sistema u
|
||||
ON bl.id_usuario = u.id_usuario
|
||||
WHERE bl.id_usuario = ?
|
||||
ORDER BY bl.fecha DESC";
|
||||
$stmt = sqlsrv_query($conn, $sql, [$id_usuario]);
|
||||
|
||||
$cambios = [];
|
||||
if ($stmt === false) {
|
||||
die(print_r(sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$registros = [];
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
$cambios[] = $row;
|
||||
$registros[] = $row;
|
||||
}
|
||||
|
||||
include __DIR__ . '/../../views/bitacoras/bitacora_usuario.php';
|
||||
}
|
||||
|
||||
function bitacoraUsuarios()
|
||||
{
|
||||
|
||||
|
||||
include __DIR__ . '/../../views/admin/bitacora_usuarios.php';
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-registros-agencias">
|
||||
<thead>
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
@@ -53,9 +53,9 @@
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_agencia'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_agencia'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['accion'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['realizado_por'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['fecha'] ? $r['fecha']->format('Y-m-d H:i:s') : '') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins">
|
||||
<thead>
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
|
||||
@@ -35,8 +35,52 @@
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">👥 Acceso de Usuarios</h4>
|
||||
<h4 class="mb-4">👥 Mi Actividad</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins-usuario">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>IP</th>
|
||||
<th>Fecha</th>
|
||||
<th>Estatus</th>
|
||||
<th>Detalles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['email'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($r['ip'] ?? '') ?></td>
|
||||
<td><?= $r['fecha']->format('Y-m-d H:i:s') ?></td>
|
||||
<td>
|
||||
<?= $r['exito'] == 1 ? 'Éxito' : 'Fallido' ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($r['detalle']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-logins-usuario').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -34,5 +34,51 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">🔗 Vinculaciones</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped align-middle" id="tabla-bitacora-vinculaciones">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Usuario</th>
|
||||
<th>Acción</th>
|
||||
<th>Aprobado por</th>
|
||||
<th>Fecha</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_relacion']) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_importador'])) ?></td>
|
||||
<td>
|
||||
<span class="badge bg-<?= $r['accion'] === 'Vinculación' ? 'success' : 'danger' ?>">
|
||||
<?= $r['accion'] ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_aprobador'] ?? '')) ?></td>
|
||||
<td><?= $r['fecha'] instanceof DateTime ? $r['fecha']->format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-bitacora-vinculaciones').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -123,10 +123,20 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm p-3">
|
||||
<h5 class="text-success">Mi actividad</h5>
|
||||
<h5 class="text-success">Registro de vinculaciones</h5>
|
||||
<p>Ver las vinculaciones de mi agencia.</p>
|
||||
<a href="/IMPORTADORES/bitacoras/vinculaciones"
|
||||
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/vinculaciones' ? 'active' : '' ?>">
|
||||
Ver actividad
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm p-3">
|
||||
<h5 class="text-info">Mi actividad</h5>
|
||||
<p>Ver mi actividad en la plataforma.</p>
|
||||
<a href="/IMPORTADORES/bitacoras/miAcceso"
|
||||
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/miAcceso' ? 'active' : '' ?>">
|
||||
class="btn btn-info btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/miAcceso' ? 'active' : '' ?>">
|
||||
Ver mis accesos
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -34,5 +34,53 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">👥 Acceso de Usuarios</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>IP</th>
|
||||
<th>Fecha</th>
|
||||
<th>Estatus</th>
|
||||
<th>Detalles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_usuario'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['email'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($r['ip'] ?? '') ?></td>
|
||||
<td><?= $r['fecha']->format('Y-m-d H:i:s') ?></td>
|
||||
<td>
|
||||
<?= $r['exito'] == 1 ? 'Éxito' : 'Fallido' ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($r['detalle']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-logins').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -34,5 +34,51 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">🔗 Vinculaciones</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped align-middle" id="tabla-vinculaciones-usuario">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Agencia</th>
|
||||
<th>Acción</th>
|
||||
<th>Aprobado por</th>
|
||||
<th>Fecha</th> <!-- vinculación // desvinculación -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_relacion']) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_agencia'])) ?></td>
|
||||
<td>
|
||||
<span class="badge bg-<?= $r['accion'] === 'Vinculación' ? 'success' : 'danger' ?>">
|
||||
<?= $r['accion'] ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_aprobador'] ?? '')) ?></td>
|
||||
<td><?= $r['fecha'] instanceof DateTime ? $r['fecha']->format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-vinculaciones-usuario').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -233,32 +233,33 @@
|
||||
</div>
|
||||
<?php elseif (isset($datos['tipo_usuario']) && $datos['tipo_usuario'] === 'super_admin'): ?>
|
||||
<div class="card shadow-sm p-4 mb-4 bg-white">
|
||||
<div class="section-header">🔧 Información de Super Administrador</div>
|
||||
<div class="section-header">🔧 Información del Administrador</div>
|
||||
<form>
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-1 col-form-label">Nombre:</label>
|
||||
<div class="col-md-4">
|
||||
<!-- Para super_admin, NO desencriptar - usar directamente -->
|
||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
||||
<input type="text" class="form-control" value="<?= htmlspecialchars(decrypt($datos['nombre'] ?? '')) ?>" disabled>
|
||||
</div>
|
||||
<label class="col-md-2 col-form-label">Tipo de Usuario:</label>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3"></div>
|
||||
<label class="col-md-1 col-form-label">Tipo de Usuario:</label>
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" value="Super Administrador" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-2 col-form-label">Correo:</label>
|
||||
<div class="col-md-10">
|
||||
<label class="col-md-1 col-form-label">Correo:</label>
|
||||
<div class="col-md-11">
|
||||
<!-- Para super_admin, NO desencriptar - usar directamente -->
|
||||
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
||||
<input type="email" class="form-control" value="<?= htmlspecialchars(decrypt($datos['correo'] ?? '')) ?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Información adicional específica de super_admin -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-2 col-form-label">Privilegios:</label>
|
||||
<div class="col-md-10">
|
||||
<label class="col-md-1 col-form-label">Privilegios:</label>
|
||||
<div class="col-md-11">
|
||||
<textarea class="form-control" rows="2" disabled>Acceso completo al sistema - Gestión de usuarios, agencias, importadores y configuración general</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +43,7 @@ $permisos = [
|
||||
'seguridad' => true,
|
||||
'bitacoras' => [
|
||||
'acceso_usuarios_agencia' => true,
|
||||
'registro_vinculaciones' => true,
|
||||
'mi_actividad' => true
|
||||
],
|
||||
],
|
||||
@@ -83,13 +84,13 @@ $cantidadBitacoras = contarBitacorasDisponibles($permisosBitacoras);
|
||||
// Función para obtener el texto descriptivo según el permiso
|
||||
function obtenerTextoPermiso($permiso, $tipoUsuario) {
|
||||
$textos = [
|
||||
'registro_accesos' => ($tipoUsuario === 'super_admin') ? 'Registro de accesos' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Registro de cambios de usuarios' : null,
|
||||
'registro_agencias' => ($tipoUsuario === 'super_admin') ? 'Registro de agencias' : null,
|
||||
'acceso_usuarios_agencias' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Registros de accesos' : null,
|
||||
'registro_vinculaciones' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Vinculaciones (Agencia)' : null,
|
||||
'mi_actividad' => in_array($tipoUsuario, ['super_admin', 'admin_agencia', 'agente_aduanal', 'importador']) ? 'Mi actividad' : null,
|
||||
'vinculaciones_usuario' => ($tipoUsuario === 'importador') ? 'Mis vinculaciones' : null,
|
||||
'registro_accesos' => ($tipoUsuario === 'super_admin') ? 'Registro de accesos' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Cambios de usuarios' : null,
|
||||
'registro_agencias' => ($tipoUsuario === 'super_admin') ? 'Registro de agencias' : null,
|
||||
'acceso_usuarios_agencia' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Registro de accesos' : null,
|
||||
'registro_vinculaciones' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Vinculaciones (Agencia)' : null,
|
||||
'mi_actividad' => in_array($tipoUsuario, ['super_admin', 'admin_agencia', 'agente_aduanal', 'importador']) ? 'Mi actividad' : null,
|
||||
'vinculaciones_usuario' => ($tipoUsuario === 'importador') ? 'Mis vinculaciones' : null,
|
||||
];
|
||||
|
||||
return $textos[$permiso] ?? ucfirst(str_replace('_', ' ', $permiso));
|
||||
@@ -113,14 +114,13 @@ function obtenerIconoPermiso($permiso) {
|
||||
// Función para obtener la URL según el permiso
|
||||
function obtenerUrlPermiso($permiso) {
|
||||
$urls = [
|
||||
'registro_accesos' => '/IMPORTADORES/bitacoras/sistema',
|
||||
'registro_usuarios' => '/IMPORTADORES/bitacoras/usuarios',
|
||||
'registro_agencias' => '/IMPORTADORES/bitacoras/agencias',
|
||||
'acceso_usuarios_agencia' => '/IMPORTADORES/bitacoras/sistemaAgencia',
|
||||
'registro_vinculaciones' => '/IMPORTADORES/bitacoras/vinculaciones',
|
||||
'mis_vinculaciones' => '/IMPORTADORES/bitacoras/misVinculaciones',
|
||||
'mi_actividad' => '/IMPORTADORES/bitacoras/miAcceso',
|
||||
'vinculaciones_usuario' => '/IMPORTADORES/bitacoras/vinculacionesUsuario'
|
||||
'registro_accesos' => '/IMPORTADORES/bitacoras/sistema', // ✅
|
||||
'registro_usuarios' => '/IMPORTADORES/bitacoras/usuarios', // ✅
|
||||
'registro_agencias' => '/IMPORTADORES/bitacoras/agencias', // ✅
|
||||
'acceso_usuarios_agencia' => '/IMPORTADORES/bitacoras/sistemaAgencia', // ✅
|
||||
'registro_vinculaciones' => '/IMPORTADORES/bitacoras/vinculaciones', // ✅
|
||||
'mi_actividad' => '/IMPORTADORES/bitacoras/miAcceso', // ✅
|
||||
'vinculaciones_usuario' => '/IMPORTADORES/bitacoras/vinculacionesUsuario' //
|
||||
];
|
||||
|
||||
return $urls[$permiso] ?? '/IMPORTADORES/bitacoras/index';
|
||||
|
||||
Reference in New Issue
Block a user