feat: Add Group Access Control to Model Specifications and Update User Filtering Logic

This commit is contained in:
Ruben Talstra 2025-02-22 11:44:59 +01:00
parent dd762f7223
commit e8702e104d
No known key found for this signature in database
GPG key ID: 2A5A7174A60F3BEA
3 changed files with 36 additions and 12 deletions

View file

@ -19,6 +19,9 @@ export type TModelSpec = {
showIconInHeader?: boolean;
iconURL?: string | EModelEndpoint; // Allow using project-included icons
authType?: AuthType;
groups?: Array<string>; // List of group ObjectIds allowed to access this model
// badgeIcon?: string; // URL to badge icon for visual categorization
// badgeTooltip?: string; // Tooltip text for the badge
};
export const tModelSpecSchema = z.object({
@ -32,6 +35,9 @@ export const tModelSpecSchema = z.object({
showIconInHeader: z.boolean().optional(),
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
authType: authTypeSchema.optional(),
groups: z.array(z.string()).optional(),
// badgeIcon: z.string().url('Must be a valid URL').optional(),
// badgeTooltip: z.string().optional(),
});
export const specsConfigSchema = z.object({

View file

@ -106,6 +106,16 @@ export type TBackupCode = {
usedAt: Date | null;
};
export type TGroup = {
id: string;
name: string;
description?: string;
externalId?: string;
provider: 'local' | 'openid';
createdAt?: string;
updatedAt?: string;
};
export type TUser = {
id: string;
username: string;
@ -116,6 +126,7 @@ export type TUser = {
provider: string;
plugins?: string[];
backupCodes?: TBackupCode[];
groups: string[];
createdAt: string;
updatedAt: string;
};