fase 2.1: roles editables (modelo skeen.role) y permisos por accion (43 claves, 9 grupos) con enforcement en backend y gating en frontend; editor de roles/permisos/menus en Configuracion

This commit is contained in:
2026-10-11 07:32:29 +00:00
parent 75736967ef
commit 28a690aa0f
24 changed files with 1637 additions and 157 deletions

View File

@@ -142,7 +142,7 @@ interface CashReport {
const ReportesContent: FC = () => {
const [searchParams, setSearchParams] = useSearchParams();
const { hasRole, canSee, brand } = useAuth();
const { hasRole, canSee, can, brand } = useAuth();
const esAdmin = hasRole('admin');
// PuedeVer una pestana = canSee('/reportes?tab=x'): la matriz guarda claves
// por pestana y, cuando no existe la del tab, canSee cae al prefijo
@@ -287,13 +287,13 @@ const ReportesContent: FC = () => {
return (
<Layout title="Reportes" subtitle="Análisis del mes y día">
<PageHeader title="Reportes" subtitle={tabInfo?.desc || 'Análisis de la operación'}>
{tab === 'general' && (
{tab === 'general' && can('reportes.exportar') && (
<Button variant="outline" onClick={exportExcel} disabled={loading || !salesReport} loading={exporting}>
<Download size={16} className="mr-2" />
Exportar
</Button>
)}
{puedeTab('exportar') && (
{puedeTab('exportar') && can('reportes.exportar') && (
<Button
variant={tab === 'exportar' ? 'primary' : 'outline'}
onClick={() => setTab('exportar')}