mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-08 10:34:23 +01:00
🔐 feat: Granular Role-based Permissions + Entra ID Group Discovery (#7804)
This commit is contained in:
parent
6c9a29b6cf
commit
f55cdc9b7f
99 changed files with 11321 additions and 621 deletions
11
packages/data-schemas/src/models/accessRole.ts
Normal file
11
packages/data-schemas/src/models/accessRole.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import accessRoleSchema from '~/schema/accessRole';
|
||||
import type * as t from '~/types';
|
||||
|
||||
/**
|
||||
* Creates or returns the AccessRole model using the provided mongoose instance and schema
|
||||
*/
|
||||
export function createAccessRoleModel(mongoose: typeof import('mongoose')) {
|
||||
return (
|
||||
mongoose.models.AccessRole || mongoose.model<t.IAccessRole>('AccessRole', accessRoleSchema)
|
||||
);
|
||||
}
|
||||
9
packages/data-schemas/src/models/aclEntry.ts
Normal file
9
packages/data-schemas/src/models/aclEntry.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import aclEntrySchema from '~/schema/aclEntry';
|
||||
import type * as t from '~/types';
|
||||
|
||||
/**
|
||||
* Creates or returns the AclEntry model using the provided mongoose instance and schema
|
||||
*/
|
||||
export function createAclEntryModel(mongoose: typeof import('mongoose')) {
|
||||
return mongoose.models.AclEntry || mongoose.model<t.IAclEntry>('AclEntry', aclEntrySchema);
|
||||
}
|
||||
9
packages/data-schemas/src/models/group.ts
Normal file
9
packages/data-schemas/src/models/group.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import groupSchema from '~/schema/group';
|
||||
import type * as t from '~/types';
|
||||
|
||||
/**
|
||||
* Creates or returns the Group model using the provided mongoose instance and schema
|
||||
*/
|
||||
export function createGroupModel(mongoose: typeof import('mongoose')) {
|
||||
return mongoose.models.Group || mongoose.model<t.IGroup>('Group', groupSchema);
|
||||
}
|
||||
|
|
@ -21,6 +21,9 @@ import { createConversationTagModel } from './conversationTag';
|
|||
import { createSharedLinkModel } from './sharedLink';
|
||||
import { createToolCallModel } from './toolCall';
|
||||
import { createMemoryModel } from './memory';
|
||||
import { createAccessRoleModel } from './accessRole';
|
||||
import { createAclEntryModel } from './aclEntry';
|
||||
import { createGroupModel } from './group';
|
||||
|
||||
/**
|
||||
* Creates all database models for all collections
|
||||
|
|
@ -50,5 +53,8 @@ export function createModels(mongoose: typeof import('mongoose')) {
|
|||
SharedLink: createSharedLinkModel(mongoose),
|
||||
ToolCall: createToolCallModel(mongoose),
|
||||
MemoryEntry: createMemoryModel(mongoose),
|
||||
AccessRole: createAccessRoleModel(mongoose),
|
||||
AclEntry: createAclEntryModel(mongoose),
|
||||
Group: createGroupModel(mongoose),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue