chore: Update people picker access middleware to use PrincipalType constants

This commit is contained in:
Danny Avila 2025-08-03 23:45:35 -04:00
parent 4e7379a861
commit 4736a60c47
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -1,4 +1,4 @@
const { PermissionTypes, Permissions } = require('librechat-data-provider');
const { PrincipalType, PermissionTypes, Permissions } = require('librechat-data-provider');
const { getRoleByName } = require('~/models/Role');
const { logger } = require('~/config');
@ -32,14 +32,14 @@ const checkPeoplePickerAccess = async (req, res, next) => {
const canViewUsers = peoplePickerPerms[Permissions.VIEW_USERS] === true;
const canViewGroups = peoplePickerPerms[Permissions.VIEW_GROUPS] === true;
if (type === 'user') {
if (type === PrincipalType.USER) {
if (!canViewUsers) {
return res.status(403).json({
error: 'Forbidden',
message: 'Insufficient permissions to search for users',
});
}
} else if (type === 'group') {
} else if (type === PrincipalType.GROUP) {
if (!canViewGroups) {
return res.status(403).json({
error: 'Forbidden',