ff-admin/src/types/permissionTypes.ts

31 lines
950 B
TypeScript
Raw Normal View History

export type PermissionSection = "club" | "settings" | "user";
export type PermissionModule =
| "members"
| "calendar"
| "newsletter"
| "protocoll"
| "qualification"
| "award"
| "executive_position"
| "communication"
| "user"
| "role";
export type PermissionType = "create" | "read" | "update" | "delete";
export type PermissionString =
| `${PermissionSection}.${PermissionModule}.${PermissionType}` // für spezifische Berechtigungen
| `${PermissionSection}.${PermissionModule}.*` // für alle Berechtigungen in einem Modul
| `${PermissionSection}.${PermissionType}` // für spezifische Berechtigungen in einem Abschnitt
| `${PermissionSection}.*` // für alle Berechtigungen in einem Abschnitt
| "*"; // für Admin
export type PermissionObject = {
[section in PermissionSection]?: {
[module in PermissionModule]?: Array<PermissionType> | "*";
} & { all?: PermissionType | "*" };
} & {
admin?: boolean;
};