mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-21 01:44:09 +01:00
🎏 refactor: Streamline Role Permissions from Interface Config
This commit is contained in:
parent
b742c8c7f9
commit
e8ddd279fd
5 changed files with 1008 additions and 231 deletions
|
|
@ -8,50 +8,50 @@ import type { IRole } from '~/types';
|
|||
const rolePermissionsSchema = new Schema(
|
||||
{
|
||||
[PermissionTypes.BOOKMARKS]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.PROMPTS]: {
|
||||
[Permissions.SHARED_GLOBAL]: { type: Boolean, default: false },
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.CREATE]: { type: Boolean, default: true },
|
||||
[Permissions.SHARED_GLOBAL]: { type: Boolean },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
[Permissions.CREATE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.MEMORIES]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.CREATE]: { type: Boolean, default: true },
|
||||
[Permissions.UPDATE]: { type: Boolean, default: true },
|
||||
[Permissions.READ]: { type: Boolean, default: true },
|
||||
[Permissions.OPT_OUT]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
[Permissions.CREATE]: { type: Boolean },
|
||||
[Permissions.UPDATE]: { type: Boolean },
|
||||
[Permissions.READ]: { type: Boolean },
|
||||
[Permissions.OPT_OUT]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.AGENTS]: {
|
||||
[Permissions.SHARED_GLOBAL]: { type: Boolean, default: false },
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.CREATE]: { type: Boolean, default: true },
|
||||
[Permissions.SHARED_GLOBAL]: { type: Boolean },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
[Permissions.CREATE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.MULTI_CONVO]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.TEMPORARY_CHAT]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.RUN_CODE]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.WEB_SEARCH]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.PEOPLE_PICKER]: {
|
||||
[Permissions.VIEW_USERS]: { type: Boolean, default: false },
|
||||
[Permissions.VIEW_GROUPS]: { type: Boolean, default: false },
|
||||
[Permissions.VIEW_ROLES]: { type: Boolean, default: false },
|
||||
[Permissions.VIEW_USERS]: { type: Boolean },
|
||||
[Permissions.VIEW_GROUPS]: { type: Boolean },
|
||||
[Permissions.VIEW_ROLES]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.MARKETPLACE]: {
|
||||
[Permissions.USE]: { type: Boolean, default: false },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.FILE_SEARCH]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
[PermissionTypes.FILE_CITATIONS]: {
|
||||
[Permissions.USE]: { type: Boolean, default: true },
|
||||
[Permissions.USE]: { type: Boolean },
|
||||
},
|
||||
},
|
||||
{ _id: false },
|
||||
|
|
@ -61,37 +61,6 @@ const roleSchema: Schema<IRole> = new Schema({
|
|||
name: { type: String, required: true, unique: true, index: true },
|
||||
permissions: {
|
||||
type: rolePermissionsSchema,
|
||||
default: () => ({
|
||||
[PermissionTypes.BOOKMARKS]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.PROMPTS]: {
|
||||
[Permissions.SHARED_GLOBAL]: false,
|
||||
[Permissions.USE]: true,
|
||||
[Permissions.CREATE]: true,
|
||||
},
|
||||
[PermissionTypes.MEMORIES]: {
|
||||
[Permissions.USE]: true,
|
||||
[Permissions.CREATE]: true,
|
||||
[Permissions.UPDATE]: true,
|
||||
[Permissions.READ]: true,
|
||||
},
|
||||
[PermissionTypes.AGENTS]: {
|
||||
[Permissions.SHARED_GLOBAL]: false,
|
||||
[Permissions.USE]: true,
|
||||
[Permissions.CREATE]: true,
|
||||
},
|
||||
[PermissionTypes.MULTI_CONVO]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.TEMPORARY_CHAT]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.RUN_CODE]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.WEB_SEARCH]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.PEOPLE_PICKER]: {
|
||||
[Permissions.VIEW_USERS]: false,
|
||||
[Permissions.VIEW_GROUPS]: false,
|
||||
[Permissions.VIEW_ROLES]: false,
|
||||
},
|
||||
[PermissionTypes.MARKETPLACE]: { [Permissions.USE]: false },
|
||||
[PermissionTypes.FILE_SEARCH]: { [Permissions.USE]: true },
|
||||
[PermissionTypes.FILE_CITATIONS]: { [Permissions.USE]: true },
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue