/api/permisos/guardar-matriz
Replaces all permission records for a given profile atomically:
- Deletes every existing
permisos_perfilrow whereidPerfilmatches. - Inserts the new set of rows supplied in the
permisosarray.
permisos array effectively removes all permissions for the profile.
Request body
ID of the profile whose permissions matrix will be replaced. The handler deletes all existing rows for this profile before inserting the new ones.
Array of permission entries to insert. If omitted or empty, all existing permissions for the profile are deleted and nothing is inserted.
Response
true when the delete-and-insert cycle completes without error.Always
"Matriz actualizada correctamente" on success.Error responses
| Status | Message | Cause |
|---|---|---|
400 | ID de perfil requerido | idPerfil is missing or coerces to 0/NaN. |
500 | Error al guardar en base de datos | Any unhandled database error during the delete or insert. |
Examples
Success response
200
Error response (400)
400
Clearing all permissions
To remove every permission for a profile without assigning new ones, send an empty array or omit thepermisos field entirely: