refactor(permissions): enhance role-based access controls across knowledge base and agent views

- Updated visibility conditions for various UI elements based on user roles, ensuring that only users with appropriate permissions (Admin, Contributor, or KB creator) can access certain actions.
- Introduced computed properties to manage permissions for sharing knowledge bases, managing data sources, and executing graph extraction.
- Adjusted the AgentList and KnowledgeBase components to reflect these changes, improving user experience by preventing unauthorized actions from being displayed.
- Ensured that the backend routes are aligned with the updated frontend role checks, enhancing security and clarity in user interactions.
This commit is contained in:
wizardchen
2026-05-15 17:56:58 +08:00
committed by lyingbug
parent e7f9a6580a
commit c6a2f6c8cc
9 changed files with 104 additions and 28 deletions
+6 -3
View File
@@ -679,9 +679,12 @@ func RegisterMCPServiceRoutes(
agentTool := r.Group("/agent")
{
// Resolving a pending tool-approval lets the agent run a sensitive
// external command on this tenant's behalf — Admin+.
agentTool.POST("/tool-approvals/:pending_id", g.Admin(), handler.ResolveToolApproval)
// Resolving a pending tool-approval is gated to tenant members
// (Viewer+). The approval card surfaces inside an agent chat the
// caller initiated — restricting it to Admin+ blocks the only
// people who actually have context to approve, so the gate is
// kept at "anyone in the tenant" instead.
agentTool.POST("/tool-approvals/:pending_id", g.Viewer(), handler.ResolveToolApproval)
}
}