feat: version 3.1.0 -- Acceso por modulo y por usuario
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,15 +9,16 @@ import { useBranding } from '../context/branding-context.jsx';
|
||||
import logoIcon from '../assets/logoLinkedTrackIcon.png';
|
||||
import { getDevicesAccess } from '../services/devices.js';
|
||||
import pkg from '../../package.json';
|
||||
import { hasModule } from '../utils/modules.js';
|
||||
|
||||
const ITEMS = [
|
||||
{ to: '/', icon: LayoutDashboard, labelKey: 'nav_dashboard', end: true },
|
||||
{ to: '/proyectos', icon: FolderKanban, labelKey: 'nav_projects' },
|
||||
{ to: '/tareas-recurrentes', icon: Repeat, labelKey: 'nav_recurring_tasks' },
|
||||
{ to: '/notas', icon: StickyNote, labelKey: 'nav_notes' },
|
||||
{ to: '/contrasenas', icon: KeyRound, labelKey: 'nav_passwords' },
|
||||
{ to: '/equipos', icon: Monitor, labelKey: 'nav_devices', needsDevicesAccess: true },
|
||||
{ to: '/organizacion', icon: Building2, labelKey: 'nav_organization' },
|
||||
{ to: '/proyectos', module: 'projects', icon: FolderKanban, labelKey: 'nav_projects' },
|
||||
{ to: '/tareas-recurrentes', module: 'recurring_tasks', icon: Repeat, labelKey: 'nav_recurring_tasks' },
|
||||
{ to: '/notas', module: 'notes', icon: StickyNote, labelKey: 'nav_notes' },
|
||||
{ to: '/contrasenas', module: 'vault', icon: KeyRound, labelKey: 'nav_passwords' },
|
||||
{ to: '/equipos', module: 'devices', icon: Monitor, labelKey: 'nav_devices', needsDevicesAccess: true },
|
||||
{ to: '/organizacion', module: 'organization', icon: Building2, labelKey: 'nav_organization' },
|
||||
{ to: '/configuracion', icon: Settings, labelKey: 'nav_config', superadminOnly: true },
|
||||
];
|
||||
|
||||
@@ -34,7 +35,7 @@ export function NavigationView({ mode, mobileOpen, onNavigate }) {
|
||||
if (!user) return;
|
||||
getDevicesAccess().then((a) => setCanSeeDevices(!!a?.canView)).catch(() => setCanSeeDevices(false));
|
||||
}, [user?.id]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const items = ITEMS.filter((item) => (!item.superadminOnly || user?.roleCode === 'superadmin') && (!item.needsDevicesAccess || canSeeDevices));
|
||||
const items = ITEMS.filter((item) => hasModule(user, item.module) && (!item.superadminOnly || user?.roleCode === 'superadmin') && (!item.needsDevicesAccess || canSeeDevices));
|
||||
const brandName = branding.name || t('appName');
|
||||
// Menus con borradores pendientes (el borrador guarda la ruta donde se estaba editando).
|
||||
const drafts = useUserDrafts();
|
||||
|
||||
Reference in New Issue
Block a user