👁️‍🗨️ refactor: use PermissionBits.VIEW in useAgentsMap for requiredPermission

This commit is contained in:
Danny Avila 2025-08-13 00:35:12 -04:00
parent 803ade8601
commit b742c8c7f9
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
7 changed files with 32 additions and 36 deletions

View file

@ -0,0 +1,18 @@
import { Permissions, PermissionBits, PermissionTypes } from 'librechat-data-provider';
import { useHasAccess } from '~/hooks/Roles';
/**
* Hook to determine the appropriate permission level for agent queries based on marketplace configuration
*/
const useAgentDefaultPermissionLevel = () => {
const hasMarketplaceAccess = useHasAccess({
permissionType: PermissionTypes.MARKETPLACE,
permission: Permissions.USE,
});
// When marketplace is active: EDIT permissions (builder mode)
// When marketplace is not active: VIEW permissions (browse mode)
return hasMarketplaceAccess ? PermissionBits.EDIT : PermissionBits.VIEW;
};
export default useAgentDefaultPermissionLevel;