Frontend: - Replace Next.js with Vite + React + TypeScript - Add new component architecture (app-shell, sidebar, dashboard modules) - Implement product modules: FRAME, safety protocols, walkthrough checkin, campus/staff attendance, personality quiz, sign language, classroom timer - Add shadcn/ui component library with Tailwind CSS - Remove legacy generated components, stores, and pages Backend: - Add product migrations: frame_entries, user_progress, safety_quiz_results, walkthrough_checkins, communication_events, personality_quiz_results, campus_attendance_config/summaries, staff_attendance_records, content_catalog - Add corresponding models, services, and routes - Implement cookie-based auth with refresh token rotation - Add content catalog seeder with product content - Migrate to ESLint flat config - Switch from yarn to npm Infrastructure: - Update .gitignore for new tooling - Add project documentation (CLAUDE.md, docs/) - Remove deprecated config files and yarn.lock Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
19 lines
549 B
TypeScript
19 lines
549 B
TypeScript
|
|
export function hasPermission(user, permission_name: string | string[]) {
|
|
if (!user?.app_role?.name) return false;
|
|
if (!permission_name) {
|
|
return true;
|
|
}
|
|
const permissions = new Set<string>([
|
|
...(user?.custom_permissions ?? []).map((p) => p.name),
|
|
...(user?.app_role_permissions ?? []).map((p) => p.name),
|
|
]);
|
|
|
|
if (typeof permission_name === 'string') {
|
|
return permissions.has(permission_name) || user.app_role.globalAccess
|
|
} else {
|
|
return permission_name.some((permission) => permissions.has(permission));
|
|
}
|
|
}
|
|
|