Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Israel-Perez/Nuxt-Secure/llms.txt

Use this file to discover all available pages before exploring further.

The Matriz de Permisos por Perfil page (/seguridad/permisos) gives administrators a visual grid to control exactly what each profile can do in every module. Each cell in the matrix is a checkbox representing one permission action.

Overview

The matrix page lists every registered module as a row and exposes five permission flags per module. You select a profile from the dropdown, review or adjust the checkboxes, and save the entire configuration in a single operation. Access requires the bitConsulta permission on the PERMISOS-PERFIL module. Without it, the application redirects you to / before the page renders.

The five permission flags

Each module row exposes the following toggleable flags:
FlagUI labelDescription
bitConsultaConsultarView and list records in the module
bitAgregarAgregarCreate new records
bitEditarEditarEdit existing records
bitDetalleDetalleOpen the detail view of a record
bitEliminarEliminarDelete records
All flags default to false. A flag must be explicitly enabled for the corresponding action to be permitted.

Using the matrix

1

Select a profile

Use the Perfil del Sistema dropdown at the top of the page to choose the profile you want to configure. The dropdown lists all profiles registered in the system.
2

Review the current permissions

Once a profile is selected, the matrix loads the profile’s current permission set. Each row represents a module; each column represents one of the five actions. Checked boxes indicate granted permissions.
3

Toggle checkboxes

Click any checkbox to grant or revoke the corresponding permission for that module and action. You can modify as many rows and flags as needed before saving.Checkboxes are disabled (read-only) if you do not have bitEditar on the PERMISOS-PERFIL module.
4

Click Guardar Permisos

Click the Guardar Permisos button to submit your changes. This button only appears if you have bitEditar on the PERMISOS-PERFIL module.
5

Confirm the update

A confirmation modal appears with the message: “¿Estás seguro de que deseas actualizar todos los permisos para el perfil: [nombre del perfil]?” Click Confirm to proceed or Cancel to go back.

How saving works

Saving calls POST /api/permisos/guardar-matriz with the entire matrix for the selected profile as a single payload:
{
  "idPerfil": 2,
  "permisos": [
    {
      "idModulo": 1,
      "bitConsulta": true,
      "bitAgregar": true,
      "bitEditar": false,
      "bitDetalle": true,
      "bitEliminar": false
    }
  ]
}
The endpoint replaces the existing permission rows for that profile atomically — it does not apply a diff. If the profile being edited belongs to the currently logged-in administrator, cargarMisPermisos is called immediately after saving so the session reflects the new permissions without requiring a logout.

Permission gates

Actions on the permissions page are gated by the PERMISOS-PERFIL module:
Permission flagControls
bitConsultaView the matrix and access the page
bitEditarEnable checkboxes and show the Guardar Permisos button

Permissions data model

The permisos_perfil table stores one row per profile-module combination:
ColumnTypeRequiredDescription
idserial PKYesAuto-increment primary key
idModulointeger FKYesReferences modulo.id
idPerfilinteger FKYesReferences perfil.id
bitConsultabooleanYesView permission (default false)
bitAgregarbooleanYesCreate permission (default false)
bitEditarbooleanYesEdit permission (default false)
bitEliminarbooleanYesDelete permission (default false)
bitDetallebooleanYesDetail view permission (default false)
Permission changes take effect the next time the affected user’s session loads their permissions. This happens automatically at login via cargarMisPermisos. If you need the changes to apply to a currently active session, the user must log out and back in — unless the edited profile belongs to you, in which case the session is refreshed immediately after saving.
Removing bitConsulta from a module for a profile will immediately redirect any user with that profile who is currently on that module’s page to the root /. The route guard checks bitConsulta on every page mount.

Role-based access control

Understand how the permission flags are evaluated at runtime.

Module management

Register the modules that appear as rows in the matrix.