Skip to content

fix(#802): add OR-based self-relevant filter fields to data export workflow API#604

Merged
LordofAvernus merged 1 commit intomainfrom
dms/fix-802
Apr 30, 2026
Merged

fix(#802): add OR-based self-relevant filter fields to data export workflow API#604
LordofAvernus merged 1 commit intomainfrom
dms/fix-802

Conversation

@LordofAvernus
Copy link
Copy Markdown
Collaborator

@LordofAvernus LordofAvernus commented Apr 30, 2026

User description

Summary

  • Add CheckUserCanAccess, CurrentUserID and ViewableDBServiceUids fields to FilterGlobalDataExportWorkflowReq
  • Add fuzzy_keyword and new fields to HTTP client query serialization

Related Issue

Refs: https://github.com/actiontech/dms-ee/issues/802


Description

  • 新增 OR-based 自相关筛选字段

  • 更新 API 与 dms-common 层代码

  • 添加 HTTP 查询参数对新字段的支持


Diagram Walkthrough

flowchart LR
  A["api/dms/service/v1/data_export_workflow.go"] --> B["pkg/dms-common/api/dms/v1/workflow.go"]
  B --> C["pkg/dms-common/dmsobject/data_export_workflow.go"]
Loading

File Walkthrough

Relevant files
Enhancement
data_export_workflow.go
API层新增 OR筛选字段                                                                                       

api/dms/service/v1/data_export_workflow.go

  • 添加 CheckUserCanAccess, CurrentUserID, ViewableDBServiceUids 字段
  • 增加 OR-based 自相关筛选逻辑描述
+9/-0     
workflow.go
dms-common请求结构体字段更新                                                                           

pkg/dms-common/api/dms/v1/workflow.go

  • 同步新增字段至 FilterGlobalDataExportWorkflowReq 结构体
  • 替换原有 AND 逻辑为 OR 筛选逻辑
+8/-0     
data_export_workflow.go
HTTP请求参数新增支持新字段                                                                                   

pkg/dms-common/dmsobject/data_export_workflow.go

  • 新增 HTTP 查询参数映射新字段
  • 支持 OR 筛选字段在请求中的传递
+20/-0   

…taExportWorkflowReq

Add CheckUserCanAccess, CurrentUserID and ViewableDBServiceUids fields
to FilterGlobalDataExportWorkflowReq in both api and dms-common layers.
Add fuzzy_keyword and new fields to HTTP client query serialization.

Refs: dms-ee#802
@actiontech-bot actiontech-bot requested a review from BugsGuru April 30, 2026 05:42
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

参数校验缺失

当启用 OR-based 自相关筛选时,应确保 CurrentUserID 非空以防权限判断错误,建议增加必要的非空验证。

if req.CheckUserCanAccess {
	query.Set("check_user_can_access", "true")
}

if req.CurrentUserID != "" {
	query.Set("current_user_id", req.CurrentUserID)
}

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
增加用户ID校验


建议在设置查询参数前进一步校验,当req.CheckUserCanAccess为true时应确保req.CurrentUserID不为空,否则传递空的用户ID可能导致数据过滤错误或业务逻辑异常。可以在判断条件中增加对CurrentUserID的检查,并在发现异常时进行错误处理或记录日志。

pkg/dms-common/dmsobject/data_export_workflow.go [65-71]

 if req.CheckUserCanAccess {
+		// 当启用CheckUserCanAccess时,CurrentUserID必须非空
+		if req.CurrentUserID == "" {
+			// TODO: 添加错误处理逻辑,如返回错误或记录警告
+		}
 		query.Set("check_user_can_access", "true")
-	}
-
-	if req.CurrentUserID != "" {
 		query.Set("current_user_id", req.CurrentUserID)
 	}
Suggestion importance[1-10]: 7

__

Why: The suggestion introduces a check for an empty CurrentUserID when CheckUserCanAccess is true, enhancing error handling. However, since it only sketches error handling logic without a full implementation, the moderate score is appropriate.

Medium

@LordofAvernus LordofAvernus merged commit 23c6893 into main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants