Add automatic role assignment for new and existing users

- Implemented auto-assignment of the 'private' role for new users upon first login, ensuring they have access to products.
- Added a safety check to assign the 'private' role to existing users without roles during login.
- Updated relevant documentation to reflect these changes in role management and visibility patterns.
This commit is contained in:
Bastian Masanek
2025-11-02 10:40:52 +01:00
parent 268d91f548
commit cb4810893c
4 changed files with 69 additions and 2 deletions

View File

@@ -1544,6 +1544,11 @@ try {
**Automatische Rollen-Zuweisung (MVP):**
- Neue User erhalten bei erster Anmeldung automatisch die Rolle `private` (Status: `approved`)
- Implementierung in `server/api/auth/login.post.ts` nach User-Profile-Erstellung
- Safety-Check: Bestehende User ohne Rollen erhalten ebenfalls `private` Rolle
**Opt-in Sichtbarkeit:**
- Produkte OHNE `product_role_visibility` Einträge sind für NIEMANDEN sichtbar
- Produkte MIT Einträgen sind nur für User mit passender `approved` Rolle sichtbar
### 4.2 Drizzle Schema Definition