diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vue index 40c7310d..2f1458d9 100644 --- a/frontend/src/views/agent/AgentList.vue +++ b/frontend/src/views/agent/AgentList.vue @@ -352,7 +352,7 @@ {{ $t('listSpaceSidebar.mine') }} { return orgStore.canManageKB(kbId.value, false); }); +// Can mutate knowledge (move / batch-delete): the backend gate for these +// two endpoints is g.Contributor(), so the caller MUST be Contributor+ +// in their tenant on top of having KB edit permission. Without the extra +// role check, an org-share-editor whose tenant role is Viewer would see +// the "Move" / "Batch manage" entries and 403 on click. +const canMutateKnowledge = computed(() => { + if (!canEdit.value) return false; + if (isOwner.value) return true; + if (authStore.hasRole('admin')) return true; + return authStore.hasRole('contributor'); +}); + // Current KB's shared record (when accessed via organization share) const currentSharedKb = computed(() => orgStore.sharedKnowledgeBases.find((s) => s.knowledge_base?.id === kbId.value) ?? null, @@ -2036,7 +2048,7 @@ async function createNewSession(value: string): Promise {
- +