Add role-based authorization system with admin functionality
- Implement authorization middleware and composables for role checking - Add groups/roles support to authentication and session management - Create admin dashboard pages and API endpoints - Add audit logging utility for tracking user actions - Enhance expense page with role-based access control - Improve session caching with authorization state management
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { requireAuth } from '@/server/utils/auth';
|
||||
import { requireSalesOrAdmin } from '@/server/utils/auth';
|
||||
import { logAuditEvent } from '@/server/utils/audit-logger';
|
||||
import { getExpenseById } from '@/server/utils/nocodb';
|
||||
import { processExpenseWithCurrency } from '@/server/utils/currency';
|
||||
import { uploadBuffer } from '@/server/utils/minio';
|
||||
import type { Expense } from '@/utils/types';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
await requireAuth(event);
|
||||
await requireSalesOrAdmin(event);
|
||||
|
||||
const body = await readBody(event);
|
||||
const { expenseIds } = body;
|
||||
@@ -141,7 +142,7 @@ export default defineEventHandler(async (event) => {
|
||||
// Return CSV for direct download
|
||||
setHeader(event, 'Content-Type', 'text/csv');
|
||||
setHeader(event, 'Content-Disposition', `attachment; filename="${filename}"`);
|
||||
setHeader(event, 'Content-Length', csvBuffer.length.toString());
|
||||
setHeader(event, 'Content-Length', csvBuffer.length);
|
||||
|
||||
return csvContent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user