mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-28 07:17:04 +02:00
feat(core): Only fetch credentials available in user's personal project on Chat (no-changelog) (#22465)
This commit is contained in:
parent
9f2efb75aa
commit
58a0e4da2e
|
|
@ -86,9 +86,11 @@ onMounted(async () => {
|
|||
if (!settingsStore.isChatFeatureEnabled) {
|
||||
return;
|
||||
}
|
||||
await fetchSettings();
|
||||
await credentialsStore.fetchAllCredentials();
|
||||
await credentialsStore.fetchCredentialTypes(false);
|
||||
await Promise.all([
|
||||
fetchSettings(),
|
||||
credentialsStore.fetchAllCredentials(),
|
||||
credentialsStore.fetchCredentialTypes(false),
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { LOCAL_STORAGE_CHAT_HUB_CREDENTIALS } from '@/app/constants';
|
||||
import { useSettingsStore } from '@/app/stores/settings.store';
|
||||
import { hasPermission } from '@/app/utils/rbac/permissions';
|
||||
import { credentialsMapSchema, type CredentialsMap } from '@/features/ai/chatHub/chat.types';
|
||||
import { useProjectsStore } from '@/features/collaboration/projects/projects.store';
|
||||
import { useCredentialsStore } from '@/features/credentials/credentials.store';
|
||||
|
|
@ -102,16 +101,9 @@ export function useChatCredentials(userId: string) {
|
|||
() => projectStore.personalProject,
|
||||
async (personalProject) => {
|
||||
if (personalProject) {
|
||||
const hasGlobalCredentialRead = hasPermission(['rbac'], {
|
||||
rbac: { scope: 'credential:read' },
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
credentialsStore.fetchCredentialTypes(false),
|
||||
// For non-owner users only fetch credentials from personal project.
|
||||
hasGlobalCredentialRead
|
||||
? credentialsStore.fetchAllCredentials()
|
||||
: credentialsStore.fetchAllCredentials(personalProject.id),
|
||||
credentialsStore.fetchAllCredentialsForWorkflow({ projectId: personalProject.id }),
|
||||
]);
|
||||
|
||||
isInitialized.value = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user