Cambio de contraseña desde dashboard de cualquier tipo de usuario
This commit is contained in:
@@ -20,6 +20,7 @@ $permisos = [
|
||||
'seguridad' => true,
|
||||
'bitacoras' => [
|
||||
'registro_accesos' => true,
|
||||
'registro_cambios' => true,
|
||||
'registro_usuarios' => true,
|
||||
'registro_agencias' => true,
|
||||
'mi_actividad' => true
|
||||
@@ -85,7 +86,8 @@ $cantidadBitacoras = contarBitacorasDisponibles($permisosBitacoras);
|
||||
function obtenerTextoPermiso($permiso, $tipoUsuario) {
|
||||
$textos = [
|
||||
'registro_accesos' => ($tipoUsuario === 'super_admin') ? 'Registro de accesos' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Cambios de usuarios' : null,
|
||||
'registro_cambios' => ($tipoUsuario === 'super_admin') ? 'Cambios de usuarios' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Registro 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,
|
||||
@@ -100,6 +102,7 @@ function obtenerTextoPermiso($permiso, $tipoUsuario) {
|
||||
function obtenerIconoPermiso($permiso) {
|
||||
$iconos = [
|
||||
'registro_accesos' => '🌐',
|
||||
'registro_cambios' => '🔄',
|
||||
'registro_usuarios' => '👥',
|
||||
'registro_agencias' => '🏪',
|
||||
'acceso_usuarios_agencia' => '👥',
|
||||
@@ -115,12 +118,13 @@ function obtenerIconoPermiso($permiso) {
|
||||
function obtenerUrlPermiso($permiso) {
|
||||
$urls = [
|
||||
'registro_accesos' => '/IMPORTADORES/bitacoras/sistema', // ✅
|
||||
'registro_usuarios' => '/IMPORTADORES/bitacoras/usuarios', // ✅
|
||||
'registro_cambios' => '/IMPORTADORES/bitacoras/cambios', // ✅
|
||||
'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' //
|
||||
'vinculaciones_usuario' => '/IMPORTADORES/bitacoras/vinculacionesUsuario' // ✅
|
||||
];
|
||||
|
||||
return $urls[$permiso] ?? '/IMPORTADORES/bitacoras/index';
|
||||
@@ -158,19 +162,19 @@ function obtenerUrlPermiso($permiso) {
|
||||
<span class="user-badge bg-info text-dark ms-2"><?= strtoupper(str_replace('_', ' ', $tipoUsuario)) ?></span>
|
||||
</span>
|
||||
<div class="d-flex ms-auto">
|
||||
<?php
|
||||
// Definir la URL de regreso según el tipo de usuario
|
||||
$urlRegreso = match($tipoUsuario) {
|
||||
'super_admin' => '/IMPORTADORES/administrador/dashboard',
|
||||
'admin_agencia' => '/IMPORTADORES/agencias/dashboard',
|
||||
'agente_aduanal' => '/IMPORTADORES/agentes/dashboard',
|
||||
'importador' => '/IMPORTADORES/importadores/dashboard',
|
||||
default => '/IMPORTADORES/importadores/dashboard'
|
||||
};
|
||||
?>
|
||||
<a href="<?= $urlRegreso ?>" class="btn btn-outline-light btn-sm" style="margin: 0 0 0 25px;">
|
||||
← Panel Principal
|
||||
</a>
|
||||
<?php
|
||||
// Definir la URL de regreso según el tipo de usuario
|
||||
$urlRegreso = match($tipoUsuario) {
|
||||
'super_admin' => '/IMPORTADORES/administrador/dashboard',
|
||||
'admin_agencia' => '/IMPORTADORES/agencias/dashboard',
|
||||
'agente_aduanal' => '/IMPORTADORES/agentes/dashboard',
|
||||
'importador' => '/IMPORTADORES/importadores/dashboard',
|
||||
default => '/IMPORTADORES/importadores/dashboard'
|
||||
};
|
||||
?>
|
||||
<a href="<?= $urlRegreso ?>" class="btn btn-outline-light btn-sm" style="margin: 0 0 0 25px;">
|
||||
← Panel Principal
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -191,6 +195,8 @@ function obtenerUrlPermiso($permiso) {
|
||||
$esVistaPreferencias = str_contains($_SERVER['REQUEST_URI'], '/preferencias');
|
||||
// Detecta si estamos en alguna parte de automatizaciones
|
||||
$esVistaAutomatizaciones = str_contains($_SERVER['REQUEST_URI'], '/automatizaciones');
|
||||
// Detecta si estamos en alguna parte del reset
|
||||
$esVistaReset = str_contains($_SERVER['REQUEST_URI'], '/reset');
|
||||
?>
|
||||
|
||||
<!-- INFORMACIÓN GENERAL -->
|
||||
@@ -209,7 +215,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||
⚙️ Automatizaciones
|
||||
</a>
|
||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/automatizaciones/index"
|
||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||
⚙️ Automatizaciones
|
||||
@@ -237,7 +243,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/preferencias/index"
|
||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||
✅ Preferencias
|
||||
@@ -266,7 +272,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/seguridad/index"
|
||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||
👮 Seguridad
|
||||
@@ -353,7 +359,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||
⚙️ Automatizaciones
|
||||
</a>
|
||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/automatizaciones/index"
|
||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||
⚙️ Automatizaciones
|
||||
@@ -381,7 +387,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/preferencias/index"
|
||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||
✅ Preferencias
|
||||
@@ -410,7 +416,7 @@ function obtenerUrlPermiso($permiso) {
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras || $esVistaReset): ?>
|
||||
<a href="/IMPORTADORES/seguridad/index"
|
||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||
👮 Seguridad
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</a>
|
||||
|
||||
<!-- VINCULACIONES -->
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
<?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/vinculaciones') ? 'active' : '' ?>"
|
||||
data-bs-toggle="collapse" href="#submenuVinculaciones" role="button" aria-expanded="false">
|
||||
🔗 Vinculación
|
||||
@@ -66,7 +66,6 @@
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- TRANSPORTISTAS -->
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
<?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/transportistas') ? 'active' : '' ?>"
|
||||
@@ -244,7 +243,7 @@
|
||||
</a>
|
||||
|
||||
<!-- VINCULACIONES -->
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
<?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/vinculaciones') ? 'active' : '' ?>"
|
||||
data-bs-toggle="collapse" href="#submenuVinculaciones" role="button" aria-expanded="false">
|
||||
🔗 Vinculación
|
||||
@@ -262,7 +261,6 @@
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- TRANSPORTISTAS -->
|
||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
||||
|
||||
Reference in New Issue
Block a user