refactor(auth): delegate access control to be-system

Remove Agent Desk users, roles, login sessions, tokens, and local permission persistence. Expose the backend as an embeddable ai-agent module with host-provided subject lookup and operation authorization callbacks, and complete the frontend/backend repository split.
This commit is contained in:
t
2026-08-21 00:41:07 +08:00
parent 3d47227fbd
commit 2bbf42b741
447 changed files with 1901 additions and 8920 deletions
@@ -1,63 +0,0 @@
package response
import "agent-desk/internal/pkg/enums"
type PermissionResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Type string `json:"type"`
GroupName string `json:"groupName"`
Method string `json:"method"`
ApiPath string `json:"apiPath"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
}
type PermissionSyncResponse struct {
Created int `json:"created"`
Updated int `json:"updated"`
RolePermissionsAdded int `json:"rolePermissionsAdded"`
}
type RoleResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Status enums.Status `json:"status"`
IsSystem bool `json:"isSystem"`
SortNo int `json:"sortNo"`
Permissions []string `json:"permissions,omitempty"`
}
type UserResponse struct {
ID int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Mobile string `json:"mobile,omitempty"`
Email string `json:"email,omitempty"`
Status enums.Status `json:"status"`
LastLoginAt string `json:"lastLoginAt,omitempty"`
LastLoginIP string `json:"lastLoginIp,omitempty"`
Roles []RoleResponse `json:"roles,omitempty"`
Permissions []string `json:"permissions,omitempty"`
}
// CreateUserResultResponse 创建用户成功响应;password 仅在本次响应中返回一次。
type CreateUserResultResponse struct {
User *UserResponse `json:"user"`
Password string `json:"password"`
}
type SessionResponse struct {
ID int64 `json:"id"`
UserID int64 `json:"userId"`
Username string `json:"username"`
ClientType string `json:"clientType"`
ClientIP string `json:"clientIp"`
UserAgent string `json:"userAgent"`
ExpiredAt string `json:"expiredAt"`
RevokedAt string `json:"revokedAt"`
LastSeenAt string `json:"lastSeenAt"`
}
+8 -1
View File
@@ -1,6 +1,13 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type AgentUserOptionResponse struct {
ID int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
}
type AgentProfileResponse struct {
ID int64 `json:"id"`
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type AgentRunResponse struct {
ID int64 `json:"id"`
+2 -2
View File
@@ -1,8 +1,8 @@
package response
import (
"agent-desk/internal/models"
"agent-desk/internal/pkg/enums"
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
)
type AIAgentTeamResponse struct {
@@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"
"agent-desk/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/models"
)
func TestBuildAIConfigResponseOmitsAPIKey(t *testing.T) {
@@ -1,10 +1,10 @@
package response
import (
"agent-desk/internal/ai/workflow/dsl"
workflowregistry "agent-desk/internal/ai/workflow/registry"
workflowvalidator "agent-desk/internal/ai/workflow/validator"
"agent-desk/internal/pkg/enums"
"code.tczkiot.com/wlw/ai-agent/internal/ai/workflow/dsl"
workflowregistry "code.tczkiot.com/wlw/ai-agent/internal/ai/workflow/registry"
workflowvalidator "code.tczkiot.com/wlw/ai-agent/internal/ai/workflow/validator"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
)
type AIWorkflowResponse struct {
+1 -1
View File
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type AssetResponse struct {
ID int64 `json:"id"`
+1 -22
View File
@@ -1,26 +1,5 @@
package response
import "agent-desk/internal/pkg/enums"
type AuthUserResponse struct {
ID int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Status enums.Status `json:"status"`
Roles []string `json:"roles"`
}
type LoginResponse struct {
AccessToken string `json:"accessToken"`
ExpiresAt string `json:"expiresAt"`
User *AuthUserResponse `json:"user"`
Permissions []string `json:"permissions"`
Roles []string `json:"roles"`
}
type PublicConfigResponse struct {
Language string `json:"language"`
WxWorkEnabled bool `json:"wxworkEnabled"`
OIDCEnabled bool `json:"oidcEnabled"`
Language string `json:"language"`
}
@@ -1,9 +1,9 @@
package response
import (
"agent-desk/internal/models"
"agent-desk/internal/pkg/enums"
"agent-desk/internal/pkg/utils"
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/utils"
)
type ChannelResponse struct {
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type CompanyResponse struct {
ID int64 `json:"id"`
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type ConversationTagResponse struct {
ID int64 `json:"id"`
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type CustomerContactResponse struct {
ID int64 `json:"id"`
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type CustomerResponse struct {
ID int64 `json:"id"`
@@ -1,13 +0,0 @@
package response
type CustomerSessionCustomerResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type CustomerSessionExchangeResponse struct {
CustomerSessionToken string `json:"customerSessionToken"`
ExpiresAt string `json:"expiresAt"`
IdentityKey string `json:"identityKey"`
Customer CustomerSessionCustomerResponse `json:"customer"`
}
@@ -1,7 +1,7 @@
package response
import (
"agent-desk/internal/pkg/enums"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
"time"
)
+2 -2
View File
@@ -1,8 +1,8 @@
package response
import (
"agent-desk/internal/ai/mcps"
"agent-desk/internal/pkg/enums"
"code.tczkiot.com/wlw/ai-agent/internal/ai/mcps"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
)
type MCPConnectionResponse struct {
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type MessageResponse struct {
ID int64 `json:"id"`
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type QuickReplyResponse struct {
ID int64 `json:"id"`
+1 -1
View File
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type TagResponse struct {
ID int64 `json:"id"`
+1 -1
View File
@@ -1,6 +1,6 @@
package response
import "agent-desk/internal/pkg/enums"
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type TicketProgressResponse struct {
ID int64 `json:"id"`