mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-06 02:28:51 +01:00
🔒 feat: RBAC for Multi-Convo Feature (#3964)
* fix: remove duplicate keys in German language translations * wip: multi-convo role permissions * ci: Update loadDefaultInterface tests due to MULTI_CONVO * ci: update Role.spec.js with tests for MULTI_CONVO permission type * fix: Update ContentParts component to handle undefined content array * feat: render Multi-Convo based on UI permissions
This commit is contained in:
parent
d59b62174f
commit
748b41eda4
18 changed files with 302 additions and 56 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "librechat-data-provider",
|
||||
"version": "0.7.420",
|
||||
"version": "0.7.421",
|
||||
"description": "data services for librechat apps",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
|
|||
|
|
@ -460,6 +460,7 @@ export const configSchema = z.object({
|
|||
modelSelect: z.boolean().optional(),
|
||||
parameters: z.boolean().optional(),
|
||||
sidePanel: z.boolean().optional(),
|
||||
multiConvo: z.boolean().optional(),
|
||||
bookmarks: z.boolean().optional(),
|
||||
presets: z.boolean().optional(),
|
||||
prompts: z.boolean().optional(),
|
||||
|
|
@ -470,6 +471,7 @@ export const configSchema = z.object({
|
|||
parameters: true,
|
||||
sidePanel: true,
|
||||
presets: true,
|
||||
multiConvo: true,
|
||||
bookmarks: true,
|
||||
prompts: true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ export enum PermissionTypes {
|
|||
* Type for Agent Permissions
|
||||
*/
|
||||
AGENTS = 'AGENTS',
|
||||
/**
|
||||
* Type for Multi-Conversation Permissions
|
||||
*/
|
||||
MULTI_CONVO = 'MULTI_CONVO',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,17 +64,23 @@ export const agentPermissionsSchema = z.object({
|
|||
// [Permissions.SHARE]: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export const multiConvoPermissionsSchema = z.object({
|
||||
[Permissions.USE]: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export const roleSchema = z.object({
|
||||
name: z.string(),
|
||||
[PermissionTypes.PROMPTS]: promptPermissionsSchema,
|
||||
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
||||
[PermissionTypes.AGENTS]: agentPermissionsSchema,
|
||||
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema,
|
||||
});
|
||||
|
||||
export type TRole = z.infer<typeof roleSchema>;
|
||||
export type TAgentPermissions = z.infer<typeof agentPermissionsSchema>;
|
||||
export type TPromptPermissions = z.infer<typeof promptPermissionsSchema>;
|
||||
export type TBookmarkPermissions = z.infer<typeof bookmarkPermissionsSchema>;
|
||||
export type TMultiConvoPermissions = z.infer<typeof multiConvoPermissionsSchema>;
|
||||
|
||||
const defaultRolesSchema = z.object({
|
||||
[SystemRoles.ADMIN]: roleSchema.extend({
|
||||
|
|
@ -90,12 +100,16 @@ const defaultRolesSchema = z.object({
|
|||
[Permissions.CREATE]: z.boolean().default(true),
|
||||
// [Permissions.SHARE]: z.boolean().default(true),
|
||||
}),
|
||||
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema.extend({
|
||||
[Permissions.USE]: z.boolean().default(true),
|
||||
}),
|
||||
}),
|
||||
[SystemRoles.USER]: roleSchema.extend({
|
||||
name: z.literal(SystemRoles.USER),
|
||||
[PermissionTypes.PROMPTS]: promptPermissionsSchema,
|
||||
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
||||
[PermissionTypes.AGENTS]: agentPermissionsSchema,
|
||||
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -105,11 +119,13 @@ export const roleDefaults = defaultRolesSchema.parse({
|
|||
[PermissionTypes.PROMPTS]: {},
|
||||
[PermissionTypes.BOOKMARKS]: {},
|
||||
[PermissionTypes.AGENTS]: {},
|
||||
[PermissionTypes.MULTI_CONVO]: {},
|
||||
},
|
||||
[SystemRoles.USER]: {
|
||||
name: SystemRoles.USER,
|
||||
[PermissionTypes.PROMPTS]: {},
|
||||
[PermissionTypes.BOOKMARKS]: {},
|
||||
[PermissionTypes.AGENTS]: {},
|
||||
[PermissionTypes.MULTI_CONVO]: {},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -303,13 +303,16 @@ export type TInterfaceConfig = {
|
|||
openNewTab?: boolean;
|
||||
modalAcceptance?: boolean;
|
||||
modalTitle?: string;
|
||||
modalContent?: string;
|
||||
modalContent?: string | string[];
|
||||
};
|
||||
endpointsMenu: boolean;
|
||||
modelSelect: boolean;
|
||||
parameters: boolean;
|
||||
sidePanel: boolean;
|
||||
presets: boolean;
|
||||
multiConvo: boolean;
|
||||
bookmarks: boolean;
|
||||
prompts: boolean;
|
||||
};
|
||||
|
||||
export type TStartupConfig = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue