fase(9): auth module with casl rbac and session management
This commit is contained in:
28
src/modules/auth/domain/value-objects/Permission.ts
Normal file
28
src/modules/auth/domain/value-objects/Permission.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { ValueObject } from '../../../../shared/domain/ValueObject';
|
||||
|
||||
export type PermissionAction = 'create' | 'read' | 'update' | 'delete' | 'manage';
|
||||
export type PermissionSubject =
|
||||
| 'Session'
|
||||
| 'Finding'
|
||||
| 'Report'
|
||||
| 'Integration'
|
||||
| 'Organization'
|
||||
| 'User'
|
||||
| 'Settings'
|
||||
| 'License'
|
||||
| 'ApiKey'
|
||||
| 'all';
|
||||
|
||||
interface PermissionProps {
|
||||
action: PermissionAction;
|
||||
subject: PermissionSubject;
|
||||
}
|
||||
|
||||
export class Permission extends ValueObject<PermissionProps> {
|
||||
static create(action: PermissionAction, subject: PermissionSubject): Permission {
|
||||
return new Permission({ action, subject });
|
||||
}
|
||||
|
||||
get action(): PermissionAction { return this.props.action; }
|
||||
get subject(): PermissionSubject { return this.props.subject; }
|
||||
}
|
||||
Reference in New Issue
Block a user