mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00

* feat: Add 'Run Code' and 'Temporary Chat' permissions to role management * feat: Add NextFunction typedef to api/typedefs.js * feat: Add temporary chat and run code permissions to role schema * refactor: Enhance access check middleware with logging for permission errors and better typing * refactor: Set default value of USE permission to true in multiConvoPermissionsSchema * refactor: Implement checkAccess function for separation of permission validation logic from middleware * feat: Integrate permission checks for tool execution and enhance Markdown code block with execution capability * fix: Convert REDIS_MAX_LISTENERS to a number, closes #5979
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
const { PermissionTypes, Permissions } = require('librechat-data-provider');
|
|
const mongoose = require('mongoose');
|
|
|
|
const roleSchema = new mongoose.Schema({
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
unique: true,
|
|
index: true,
|
|
},
|
|
[PermissionTypes.BOOKMARKS]: {
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
[PermissionTypes.PROMPTS]: {
|
|
[Permissions.SHARED_GLOBAL]: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
[Permissions.CREATE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
[PermissionTypes.AGENTS]: {
|
|
[Permissions.SHARED_GLOBAL]: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
[Permissions.CREATE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
[PermissionTypes.MULTI_CONVO]: {
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
[PermissionTypes.TEMPORARY_CHAT]: {
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
[PermissionTypes.RUN_CODE]: {
|
|
[Permissions.USE]: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
});
|
|
|
|
const Role = mongoose.model('Role', roleSchema);
|
|
|
|
module.exports = Role;
|