🗂️ feat: Add File Search Toggle Permission for Chat Area Badge (#8605)

This commit is contained in:
Danny Avila 2025-07-22 17:51:21 -04:00 committed by GitHub
parent 5178507b1c
commit e5d08ccdf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 184 additions and 19 deletions

View file

@ -2,7 +2,9 @@ import { Schema } from 'mongoose';
import { PermissionTypes, Permissions } from 'librechat-data-provider';
import type { IRole } from '~/types';
// Create a sub-schema for permissions. Notice we disable _id for this subdocument.
/**
* Uses a sub-schema for permissions. Notice we disable `_id` for this subdocument.
*/
const rolePermissionsSchema = new Schema(
{
[PermissionTypes.BOOKMARKS]: {
@ -37,6 +39,9 @@ const rolePermissionsSchema = new Schema(
[PermissionTypes.WEB_SEARCH]: {
[Permissions.USE]: { type: Boolean, default: true },
},
[PermissionTypes.FILE_SEARCH]: {
[Permissions.USE]: { type: Boolean, default: true },
},
},
{ _id: false },
);
@ -67,6 +72,7 @@ const roleSchema: Schema<IRole> = new Schema({
[PermissionTypes.TEMPORARY_CHAT]: { [Permissions.USE]: true },
[PermissionTypes.RUN_CODE]: { [Permissions.USE]: true },
[PermissionTypes.WEB_SEARCH]: { [Permissions.USE]: true },
[PermissionTypes.FILE_SEARCH]: { [Permissions.USE]: true },
}),
},
});