From 3232f28939850ab9f4c7c798fbf0ddd8839eb70e Mon Sep 17 00:00:00 2001 From: baeyc0510 Date: Sat, 13 Dec 2025 19:00:57 +0900 Subject: [PATCH 1/5] fix(mcp): use .env CURRENT_ROLE instead of git user for RBAC --- internal/mcp/server.go | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/internal/mcp/server.go b/internal/mcp/server.go index e1a0d77..0104f3b 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -853,48 +853,36 @@ func (s *Server) convertUserPolicy(userPolicyPath, codePolicyPath string) error return ConvertPolicyWithLLM(userPolicyPath, codePolicyPath) } -// getRBACInfo returns RBAC information for the current user +// getRBACInfo returns RBAC information for the current role func (s *Server) getRBACInfo() string { - // Try to get current user - username, err := git.GetCurrentUser() - if err != nil { - // Not in a git environment or user not configured + // Get current role from .env + userRole, err := roles.GetCurrentRole() + if err != nil || userRole == "" { + // No role selected return "" } - // Get user's role - userRole, err := roles.GetUserRole(username) - if err != nil { - // Roles not configured - return "" - } - - if userRole == "none" { - return fmt.Sprintf("⚠️ RBAC: User '%s' has no assigned role. You may not have permission to modify files.", username) - } - // Load user policy to get RBAC details userPolicy, err := roles.LoadUserPolicyFromRepo() if err != nil { // User policy not available - return fmt.Sprintf("πŸ” RBAC: Current user '%s' has role '%s'", username, userRole) + return fmt.Sprintf("πŸ” RBAC: Current role '%s'", userRole) } // Check if RBAC is defined if userPolicy.RBAC == nil || userPolicy.RBAC.Roles == nil { - return fmt.Sprintf("πŸ” RBAC: Current user '%s' has role '%s' (no restrictions defined)", username, userRole) + return fmt.Sprintf("πŸ” RBAC: Current role '%s' (no restrictions defined)", userRole) } // Get role configuration roleConfig, exists := userPolicy.RBAC.Roles[userRole] if !exists { - return fmt.Sprintf("⚠️ RBAC: User '%s' has role '%s', but role is not defined in policy", username, userRole) + return fmt.Sprintf("⚠️ RBAC: Role '%s' is not defined in policy", userRole) } // Build RBAC info message var rbacMsg strings.Builder rbacMsg.WriteString("πŸ” RBAC Information:\n") - rbacMsg.WriteString(fmt.Sprintf(" User: %s\n", username)) rbacMsg.WriteString(fmt.Sprintf(" Role: %s\n", userRole)) if len(roleConfig.AllowWrite) > 0 { From e3d9cb2620dd155be010cf44aeb311df04a8646c Mon Sep 17 00:00:00 2001 From: baeyc0510 Date: Sat, 13 Dec 2025 19:01:03 +0900 Subject: [PATCH 2/5] fix(dashboard): update category dropdowns immediately and improve import modal style --- internal/server/static/index.html | 2 +- internal/server/static/policy-editor.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/server/static/index.html b/internal/server/static/index.html index e74cf8b..160d3ba 100644 --- a/internal/server/static/index.html +++ b/internal/server/static/index.html @@ -216,7 +216,7 @@