Frontend de erp-core - Workspace V2
Go to file
Adrian Flores Cortes a3b61b8ae4 [RBAC-004] feat: Add frontend permission integration
Phase 4 frontend implementation:
- permissions.api.ts: API service for GET /api/v1/permissions/me
- usePermissionStore.ts: Zustand store with caching (5min TTL)
- usePermissions.tsx: React hook with auto-fetch on auth
- CanAccess component: Permission-based conditional rendering

Features:
- can(resource, action): Single permission check
- canAny(...codes): OR logic for multiple permissions
- canAll(...codes): AND logic for multiple permissions
- hasRole/hasAnyRole: Role-based checks
- Super admin bypass
- Auto-fetch on authentication
- Cache invalidation on logout

Usage example:
```tsx
const { can, canAny } = usePermissions();
if (!can('invoices', 'create')) return <AccessDenied />;

<CanAccess permission="invoices:delete">
  <DeleteButton />
</CanAccess>
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 01:57:04 -06:00
public Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
src [RBAC-004] feat: Add frontend permission integration 2026-01-31 01:57:04 -06:00
.eslintrc.cjs Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
.gitignore chore: Add .gitignore for build artifacts 2026-01-18 06:23:50 -06:00
Dockerfile Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
index.html Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
nginx.conf Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
package-lock.json feat(hr): Add complete HR frontend module 2026-01-26 16:34:03 -06:00
package.json Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
postcss.config.js Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
tailwind.config.js Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
tsconfig.json Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
tsconfig.node.json Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
vite.config.d.ts Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00
vite.config.ts Initial commit - erp-core-frontend-web 2026-01-04 06:40:18 -06:00