feat(identity): redesign identity module and introduce RBAC foundation
- Redesign the Identity module with a richer domain model. - Extend the User entity to support username, Authentik integration, activity tracking, and storage information. - Add Role and Permission domain models with many-to-many relationships. - Implement RBAC foundation using UserRole, RolePermission, and UserPermission mappings. - Add user storage quota and usage fields with default values. - Introduce Authentik identifiers and synchronization metadata. - Refactor user domain logic for role and permission management. - Update Prisma schema to support the new identity architecture. - Improve JWT authentication and permission guard integration. - Update repositories, handlers, controllers, mappers, DTOs, and Swagger configuration. - Refresh environment configuration and project dependencies.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
export class PermissionData {
|
||||
private constructor(
|
||||
public readonly id: string,
|
||||
public code: string,
|
||||
public name: string,
|
||||
public description: string,
|
||||
public createdAt: Date,
|
||||
public updatedAt: Date,
|
||||
) {}
|
||||
|
||||
changeName(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
changeDescription(description: string) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
changeCode(code: string) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
static restore(props: {
|
||||
id: string;
|
||||
code?: string;
|
||||
name: string;
|
||||
description: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}) {
|
||||
return new PermissionData(
|
||||
props.id,
|
||||
props.code || props.name,
|
||||
props.name,
|
||||
props.description,
|
||||
props.createdAt,
|
||||
props.updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user