How laylaaza/schoolportaal works
Security Playground is a role-based school portal for students, teachers, and administrators. Users sign in, then reach role-specific dashboards: students view their own records, teachers browse and search student records, and administrators manage users and roles. Server actions handle login, logout, and account mutations; authorization checks protect server-rendered pages and record access. The repository layer serves portal data from MySQL, while password helpers verify and hash credentials. Relationships for unsampled routes are based on the SOURCE INDEX; implementation details beyond the excerpts are not assumed.
Main entry points: repository.ts Data repository · records.tsx Record views and access · auth.ts Session authorization · actions.ts Server actions
Components 18
Portal experience
- Role redirect
app/page.tsx - Login page
app/login/page.tsx - Login and user forms
components/forms.tsx - Student portal
app/student/page.tsx - Teacher portal
app/teacher/page.tsx - Admin portal
app/admin/page.tsx - User administration
app/admin/users/page.tsx - Add user page
app/admin/users/new/page.tsx - Role-aware shell
components/shell.tsx
Identity and access
- Session authorization
lib/auth.ts - Server actions
app/actions.ts - Password hashing
lib/passwords.cjs
School records
- Student search form
components/student-search.tsx - Record views and access
components/records.tsx - Portal data types
lib/models.ts
Persistence and credentials
- Data repository
lib/repository.ts - MySQL database
lib/db.ts
Other components
- Portal user
Connections 26
- Portal user → Role redirect: opens portal
app/page.tsx - Role redirect → Session authorization: checks session
app/page.tsx - Role redirect → Login page: redirects unauthenticated
app/page.tsx - Portal user → Login page: submits credentials
app/login/page.tsx - Login page → Login and user forms: renders
app/login/page.tsx - Login and user forms → Server actions: submits login
components/forms.tsx - Server actions → Data repository: authenticates and mutates
app/actions.ts - Server actions → Password hashing: verifies passwords
app/actions.ts - Data repository → Password hashing: hashes new passwords
lib/repository.ts - Data repository → MySQL database: queries and writes
lib/repository.ts - Session authorization → Data repository: loads session user
lib/auth.ts - Student portal → Session authorization: requires student
app/student/page.tsx - Student portal → Data repository: loads own record
app/student/page.tsx - Student portal → Record views and access: renders student data
app/student/page.tsx - Teacher portal → Session authorization: requires teacher
app/teacher/page.tsx - Teacher portal → Student search form: renders search
app/teacher/page.tsx - Teacher portal → Record views and access: renders student table
app/teacher/page.tsx - Record views and access → Data repository: loads and searches records
components/records.tsx - Admin portal → Session authorization: requires administrator
app/admin/page.tsx - Admin portal → Record views and access: renders user records
app/admin/page.tsx - User administration → Record views and access: renders user management
app/admin/users/page.tsx - Add user page → Login and user forms: renders account form
app/admin/users/new/page.tsx - Login and user forms → Portal data types: uses role types
components/forms.tsx - Record views and access → Portal data types: uses student types
components/records.tsx - Role-aware shell → Data repository: loads student link data
components/shell.tsx - Server actions → Session authorization: checks admin access
app/actions.ts