Skip to content

feat: add admin roles - #83

Merged
rue-22 merged 30 commits into
up-csi:mainfrom
rue-22:main
Mar 21, 2026
Merged

feat: add admin roles#83
rue-22 merged 30 commits into
up-csi:mainfrom
rue-22:main

Conversation

@rue-22

@rue-22 rue-22 commented Mar 21, 2026

Copy link
Copy Markdown
Collaborator

This PR mainly covers the following:

  • adding admin role mainly on backend
  • setting up the route groups for the admins in the frontend
  • performing some code cleanups

tm-cj-salces and others added 30 commits March 19, 2026 20:05
Add project guidance for Claude Code, a detailed implementation plan
for the admin role system, and simplified data flow diagrams.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- requireAuth(), requireRole(), isAdmin() utilities in lib/server/auth.ts
- Service-role Supabase client in lib/server/supabaseAdmin.ts (bypasses RLS)
- AppRole type includes applicant, admin, withdrawn, inactive

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The PUBLIC_ prefix exposes the service key to the browser in SvelteKit.
Renamed to SUPABASE_SERVICE_KEY and moved to secrets in deploy workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Part of Phase 3 — needed for auth helpers to type-check correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add both to .gitignore. Files kept locally but not in the repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Implement authGuard that resolves user role from profiles table
  and attaches it to event.locals on every request
- Pass userRole through layout server load to page data
- Secure /api/get_gdrive_folder and /api/upload with session-based
  auth checks, replacing browser Supabase singleton with locals.supabase

Made-with: Cursor
Sort imports alphabetically, use object destructuring for locals,
and fix require-atomic-updates race conditions in authGuard hook.

Made-with: Cursor
GitHub Actions doesn't expose secrets to fork PR workflows, so
SUPABASE_SERVICE_KEY is empty during build. Deferring client creation
to runtime prevents the "supabaseKey is required" crash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sort imports alphabetically and use separate type import with
eslint-disable to satisfy conflicting sort-imports and
no-duplicate-imports rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rue-22
rue-22 requested a review from LigsQt March 21, 2026 13:11
@LigsQt LigsQt closed this Mar 21, 2026
@rue-22 rue-22 reopened this Mar 21, 2026

@LigsQt LigsQt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@LigsQt LigsQt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 🚀

@rue-22
rue-22 merged commit 79d7ef8 into up-csi:main Mar 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants