29 lines
748 B
TypeScript
29 lines
748 B
TypeScript
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; }
|
|
}
|