mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
👁️🗨️ refactor: use PermissionBits.VIEW in useAgentsMap for requiredPermission
This commit is contained in:
parent
803ade8601
commit
b742c8c7f9
7 changed files with 32 additions and 36 deletions
18
client/src/hooks/Agents/useAgentDefaultPermissionLevel.ts
Normal file
18
client/src/hooks/Agents/useAgentDefaultPermissionLevel.ts
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue