26.2-pre2
This commit is contained in:
1 parent
ba41125eae
commit
6165f2d4f3
13 files changed
+2869
-5314
No files matched your search
@@ -23,6 +23,7 @@ export interface ConfigFilePermission {
|
||||
|
||||
export interface DashboardPermissions {
|
||||
overview: boolean;
|
||||
tickets: boolean;
|
||||
logs: boolean;
|
||||
transcripts: boolean;
|
||||
settings: { view: boolean; update: boolean };
|
||||
@@ -35,7 +36,8 @@ export interface DashboardUser {
|
||||
username: string;
|
||||
globalName: string | null;
|
||||
avatar: string;
|
||||
role: DashboardRole;
|
||||
role: string;
|
||||
groupId?: string;
|
||||
isOwner: boolean;
|
||||
permissions: DashboardPermissions;
|
||||
}
|
||||
@@ -47,6 +49,18 @@ export interface StoredDashboardUser extends DashboardUser {
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface DashboardGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
color: string;
|
||||
discordRoleId: string | null;
|
||||
isSystem: boolean;
|
||||
permissions: DashboardPermissions;
|
||||
createdAt?: number;
|
||||
updatedAt?: number;
|
||||
}
|
||||
|
||||
export const ROLE_LABELS: Record<DashboardRole, string> = {
|
||||
owner: "Owner",
|
||||
admin: "Admin",
|
||||
@@ -80,6 +94,7 @@ export function hasPermission(
|
||||
if (!permissions) return false;
|
||||
|
||||
if (key === "overview") return permissions.overview;
|
||||
if (key === "tickets") return permissions.tickets ?? permissions.overview;
|
||||
if (key === "logs") return permissions.logs;
|
||||
if (key === "transcripts") return permissions.transcripts;
|
||||
if (key === "settings.view") return permissions.settings.view;
|
||||
@@ -135,6 +150,7 @@ function configMap(view: boolean, edit: boolean): Record<ConfigFile, ConfigFileP
|
||||
export function fullPermissions(): DashboardPermissions {
|
||||
return {
|
||||
overview: true,
|
||||
tickets: true,
|
||||
logs: true,
|
||||
transcripts: true,
|
||||
settings: { view: true, update: true },
|
||||
@@ -154,6 +170,7 @@ export function defaultPermissionsForRole(
|
||||
case "moderator":
|
||||
return {
|
||||
overview: true,
|
||||
tickets: true,
|
||||
logs: true,
|
||||
transcripts: true,
|
||||
settings: { view: true, update: false },
|
||||
@@ -163,6 +180,7 @@ export function defaultPermissionsForRole(
|
||||
case "editor":
|
||||
return {
|
||||
overview: true,
|
||||
tickets: true,
|
||||
logs: true,
|
||||
transcripts: false,
|
||||
settings: { view: true, update: false },
|
||||
@@ -172,6 +190,7 @@ export function defaultPermissionsForRole(
|
||||
case "viewer":
|
||||
return {
|
||||
overview: true,
|
||||
tickets: true,
|
||||
logs: true,
|
||||
transcripts: true,
|
||||
settings: { view: true, update: false },
|
||||
|
||||
Reference in new issue
Block a user