The three roles
| Role | Who | Can |
|---|---|---|
| Owner | The account created by the seed from OWNER_EMAIL |
Everything an admin can, plus agency settings and managing admins. There is one owner. |
| Admin | Office manager, sales manager | Every listing and inquiry, assigning work, featuring listings, areas, agent accounts. |
| Agent | Sales and rental agents | Their own listings, inquiries and viewings. Create listings (always their own), delete their own drafts. |
The full matrix is on Dashboard > Roles, generated from the rules in src/lib/rules.ts:
| Permission | Owner | Admin | Agent |
|---|---|---|---|
| Work on own listings, inquiries, viewings | yes | yes | yes |
listings.all see and edit every listing |
yes | yes | no |
listings.feature feature on the home page |
yes | yes | no |
listings.assign choose a listing's agent |
yes | yes | no |
listings.delete delete any listing |
yes | yes | own drafts |
leads.all see every inquiry and viewing |
yes | yes | no |
leads.assign assign inquiries and viewings |
yes | yes | no |
staff.manage manage team accounts |
yes | agents only | no |
areas.manage areas |
yes | yes | no |
settings.edit agency settings |
yes | no | no |
Enforced on the server
Every API route checks the role again (requireStaff({ permission }) in src/lib/api.ts), and each record is checked for ownership: an agent asking for another agent's listing or inquiry gets 404, as if it did not exist. Hiding buttons in the dashboard is a convenience, not the protection. The rules are unit-tested in tests/rules.test.ts and end-to-end in scripts/e2e_api.py.
Managing the team (admin management)
Dashboard > Team:
- Add: name in both languages, email, a first password (10+ characters), role, job titles, phone, WhatsApp, languages spoken, "show on the website".
- Edit: anything above; a new password is set only when the field is filled.
- Deactivate (untick "Account active"): the person cannot sign in from their next request, even with an open session; their listings and history stay. Use this when someone leaves.
- Delete: only for accounts without listings.
Nobody can change their own role, create a second owner, or edit the owner from this page. Admins can only create and edit agents.
Sessions
Sign-in sets an httpOnly cookie valid for 12 hours, signed with AUTH_SECRET. Each request re-reads the account, so a deactivation or role change applies at once. Sign-in is limited to 10 attempts per minute per IP and 8 per 15 minutes per email.