mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 02:28:30 +08:00
14 lines
556 B
TypeScript
14 lines
556 B
TypeScript
import { useAtomValue } from 'jotai'
|
|
import { workspacePermissionKeysAtom } from '@/context/permission-state'
|
|
import { hasPermission } from '@/utils/permission'
|
|
|
|
export const useCredentialPermissions = () => {
|
|
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
|
|
|
|
return {
|
|
canUseCredential: hasPermission(workspacePermissionKeys, 'credential.use'),
|
|
canCreateCredential: hasPermission(workspacePermissionKeys, 'credential.create'),
|
|
canManageCredential: hasPermission(workspacePermissionKeys, 'credential.manage'),
|
|
}
|
|
}
|