fix: add can_view_cloud_data to login and profile API responses

- Add can_view_cloud_data field to auth login response
- Add can_view_cloud_data field to agent profile response
- Fetch latest user permissions from /agent/profile on agent layout mount
- Update localStorage with latest can_view_cloud_data value
This commit is contained in:
2026-05-11 00:15:21 +08:00
parent df4ad079f3
commit 6dcb5cde02
3 changed files with 37 additions and 14 deletions
+8 -7
View File
@@ -56,13 +56,14 @@ func (s *AuthService) Login(username, password, agentPath string) (map[string]in
// 返回用户信息和令牌
return map[string]interface{}{
"user": map[string]interface{}{
"id": user.ID,
"username": user.Username,
"email": user.Email,
"avatar": user.Avatar,
"role": user.Role,
"status": user.Status,
"parent_agent_id": user.ParentAgentID,
"id": user.ID,
"username": user.Username,
"email": user.Email,
"avatar": user.Avatar,
"role": user.Role,
"status": user.Status,
"parent_agent_id": user.ParentAgentID,
"can_view_cloud_data": user.CanViewCloudData,
},
"token": token,
}, nil