diff --git a/CHANGELOG.md b/CHANGELOG.md index 268cb2e..23e841f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [1.24.0] - 2026-10-28 + +### Added +- **Control de Acceso y Visibilidad de Funciones de Plugins por Rol (`PluginService`, `PluginSettingsComponent`, `ExecuteCommandComponent`)**: + - Incorporada especificación declarativa de roles autorizados (`roles?: string[]`) en la interfaz `PluginCommand`. + - Creada matriz interactiva de permisos en `PluginSettingsComponent` dentro de la nueva subpestaña *"Funciones y Roles"*, permitiendo a los administradores activar o revocar gráficamente el acceso a cada comando expuesto por cualquier plugin para cada rol del sistema. + - Los roles disponibles se extraen dinámicamente desde `ogcore` (`GET /user-groups`), con respaldo seguro en los roles canónicos de OpenGnSys (`ROLE_SUPER_ADMIN`, `ROLE_ORGANIZATIONAL_UNIT_ADMIN`, `ROLE_ORGANIZATIONAL_UNIT_OPERATOR`, `ROLE_ORGANIZATIONAL_UNIT_MINIMAL`). + - La personalización se persiste en la base de datos dentro de `configData.command_roles` de forma 100% desacoplada sin requerir alteraciones en el esquema backend. + - En `PluginService.getPluginGroups()`, los comandos disponibles en los menús de acción (`ExecuteCommandComponent`) se filtran reactivamente en función del rol y permisos del usuario autenticado, ocultando totalmente aquellas opciones que no le correspondan (ej. un conserje con perfil básico solo visualiza Reservar, Liberar y Renovar puesto, permaneciendo invisibles las funciones de instalación o mantenimiento). + - Total adhesión a la sintaxis moderna de control de flujo Angular (`@if`, `@for`) y diseño modular de estilos CSS sin atributos inline. + ## [1.23.0] - 2026-10-27 ### Added diff --git a/ogWebconsole/package.json b/ogWebconsole/package.json index 52f528b..a81be82 100644 --- a/ogWebconsole/package.json +++ b/ogWebconsole/package.json @@ -1,6 +1,6 @@ { "name": "og-webconsole", - "version": "1.23.0", + "version": "1.24.0", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.css b/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.css index 5f429af..65b49ff 100644 --- a/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.css +++ b/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.css @@ -913,3 +913,138 @@ 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } + +/* ========================================================================= + MATRIZ DE CONTROL DE ACCESO A FUNCIONES POR ROL + ========================================================================= */ + +.roles-intro-text { + margin: 0 0 16px 0; + font-size: 0.88rem; + color: #64748b; + line-height: 1.5; +} + +.roles-matrix-card { + background: #ffffff; + border: 1px solid #e2e8f0; + border-radius: 12px; + overflow: hidden; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); +} + +.roles-table-wrapper { + overflow-x: auto; + width: 100%; +} + +.roles-matrix-table { + width: 100%; + border-collapse: collapse; + text-align: left; +} + +.roles-matrix-table thead tr { + background: #f8fafc; + border-bottom: 2px solid #e2e8f0; +} + +.col-command-header { + padding: 14px 18px; + font-size: 0.82rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.04em; + color: #475569; + min-width: 260px; +} + +.col-role-header { + padding: 12px 16px; + text-align: center; + min-width: 140px; + border-left: 1px solid #f1f5f9; +} + +.role-header-content { + display: flex; + flex-direction: column; + align-items: center; + gap: 2px; +} + +.role-header-name { + font-size: 0.85rem; + font-weight: 700; + color: #1e293b; +} + +.role-header-key { + font-size: 0.70rem; + font-weight: 600; + color: #94a3b8; + font-family: monospace; +} + +.command-role-row { + border-bottom: 1px solid #f1f5f9; + transition: background-color 0.15s ease; +} + +.command-role-row:hover { + background-color: #f8fafc; +} + +.command-identity-cell { + padding: 14px 18px; + vertical-align: middle; +} + +.command-badge-wrapper { + display: flex; + align-items: center; + gap: 12px; +} + +.command-icon-box { + width: 36px; + height: 36px; + border-radius: 8px; + background: #f1f5f9; + color: #0284c7; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.command-icon-box mat-icon { + font-size: 20px; + width: 20px; + height: 20px; +} + +.command-details-box { + display: flex; + flex-direction: column; + gap: 2px; +} + +.command-title-text { + font-size: 0.90rem; + font-weight: 600; + color: #0f172a; +} + +.command-slug-subtext { + font-size: 0.74rem; + color: #64748b; + font-family: monospace; +} + +.role-checkbox-cell { + padding: 12px 16px; + text-align: center; + vertical-align: middle; + border-left: 1px solid #f1f5f9; +} diff --git a/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.html b/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.html index aa31f86..aa87164 100644 --- a/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.html +++ b/ogWebconsole/src/app/components/plugins/plugin-settings/plugin-settings.component.html @@ -24,32 +24,46 @@ @if (plugin.enabled) { - @if (plugin.recordsEndpoint) { + @if (plugin.recordsEndpoint || (plugin.commands && plugin.commands.length > 0)) {
} - @if (activeSubTab === 0) { + @if (activeSubTab === 'settings') {+ Configura qué roles de usuario tienen autorización para visualizar y ejecutar cada una de las funciones expuestas por este plugin. Los usuarios que no pertenezcan a los roles seleccionados no verán la opción disponible en el menú de acciones de la consola. +
+ +| Función / Acción del Plugin | + @for (role of availableRoles; track role.key) { +
+
+ {{ role.name }}
+ {{ role.shortCode || role.key }}
+
+ |
+ }
+
|---|---|
|
+
+
+
+
+ {{ getCommandLabel(cmd) }}
+ {{ cmd.slug }}
+
+ |
+
+ @for (role of availableRoles; track role.key) {
+
+ |
+ }
+