feat: RBAC Phase 3 - LegacyRole-Enum, RolesGuard und @Roles vollstaendig entfernt
Letzte Phase des RBAC-Umbaus: die transitionale Rollen-Infrastruktur, die seit Phase 1 parallel zum neuen Role/Permission-System mitlief, ist jetzt komplett weg. - Prisma-Migration: User.legacyRole-Spalte und LegacyRole-Enum gedroppt (nichts liest die Spalte mehr, seit Phase 2 jeder Controller auf @RequirePermission laeuft). - roles.guard.ts, roles.guard.spec.ts, roles.decorator.ts geloescht; RolesGuard aus den APP_GUARD-Providern entfernt. - AuthenticatedUser/JWT-Payload verlieren das role-Feld (permissions werden ohnehin frisch pro Request aus der DB aufgeloest, nicht aus dem Claim). - Users-API: CreateUserDto/UpdateUserDto akzeptieren jetzt roleId (eine echte Role.id) statt der alten role-Enum-Werte; UsersService validiert, dass die Rolle existiert und aktiv ist, bevor sie zugewiesen wird. - Alle 34 e2e-Fixtures und der Seed-Script folgen dem neuen Schema. Verifiziert: tsc, lint, build, unit (220/220), volle e2e-Suite 159/159 gruen - keine uebersprungenen Tests. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
0284077d3b
commit
ae53f7889e
51 files changed
+125
-224
No files matched your search
@@ -0,0 +1,10 @@
|
||||
-- RBAC Phase 3: drops the transitional LegacyRole enum + User.legacyRole
|
||||
-- column now that every controller runs on @RequirePermission and no code
|
||||
-- reads the legacy field anymore (see permission-catalog.ts / roles module).
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE "User" DROP COLUMN "legacyRole";
|
||||
DROP TYPE "LegacyRole";
|
||||
|
||||
COMMIT;
|
||||
@@ -16,17 +16,6 @@ datasource db {
|
||||
// Benutzer / Auth / Audit (Abschnitt 3, 14, 15, 16)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Superseded by the Role/Permission/RolePermission models below. Kept only
|
||||
// as a transitional column (User.legacyRole) until the RBAC rollout's
|
||||
// Phase 3 drops it — see docs/lastenheft.md RBAC migration notes.
|
||||
enum LegacyRole {
|
||||
ADMIN
|
||||
BEEKEEPER
|
||||
STAFF
|
||||
READONLY
|
||||
API_CLIENT
|
||||
}
|
||||
|
||||
enum RoleStatus {
|
||||
ACTIVE
|
||||
INACTIVE
|
||||
@@ -80,7 +69,6 @@ model User {
|
||||
email String @unique
|
||||
passwordHash String
|
||||
name String
|
||||
legacyRole LegacyRole @default(STAFF)
|
||||
roleId String
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
isActive Boolean @default(true)
|
||||
|
||||
@@ -30,7 +30,6 @@ async function main(): Promise<void> {
|
||||
email,
|
||||
passwordHash,
|
||||
name: 'Administrator',
|
||||
legacyRole: 'ADMIN',
|
||||
roleId: adminRole.id,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user