3825859da6
build / build (push) Successful in 2m20s
PP 增加受控凭据更新、真实登录与目录检查,待验证修改不会替换生效配置;扫描与取件共享生效修订。 钉钉来源向导、校验与登记共用 DWS 授权,支持中途恢复与换账号保护,取消旧扫码自动回落。 认证审计复用已有来源审计页,配置响应不回传密码;补齐运行镜像脚本与权限。 验证:make verify 退出 0;PP/DWS/httpapi 目标 race 回归通过;隔离 HTTP 服务验证 PP 协议及扫描/取件消费者。 尚未部署;真实 PP 凭据与目录可用性在测试站部署后验证。
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package httpapi
|
|
|
|
import (
|
|
"context"
|
|
postgresstore "knowledge-governance/internal/platform/postgres"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
type sourceAuditReader interface {
|
|
ListSourceAudit(context.Context, int, int) (postgresstore.SourceAuditPage, error)
|
|
}
|
|
|
|
func listSourceAudit(w http.ResponseWriter, r *http.Request, config Config) {
|
|
if _, ok := requireSessionIdentity(w, r); !ok {
|
|
return
|
|
}
|
|
limit, offset := 100, 0
|
|
for key, target := range map[string]*int{"limit": &limit, "offset": &offset} {
|
|
if value := r.URL.Query().Get(key); value != "" {
|
|
n, err := strconv.Atoi(value)
|
|
if err != nil {
|
|
writeJSON(w, 400, map[string]string{"error": "invalid pagination"})
|
|
return
|
|
}
|
|
*target = n
|
|
}
|
|
}
|
|
if limit < 1 || limit > 100 || offset < 0 {
|
|
writeJSON(w, 400, map[string]string{"error": "invalid pagination"})
|
|
return
|
|
}
|
|
reader, ok := config.Store.(sourceAuditReader)
|
|
if !ok {
|
|
writeJSON(w, 501, map[string]string{"error": "audit not configured"})
|
|
return
|
|
}
|
|
page, err := combinedSourceAudit(r.Context(), reader, config.PPConnection, limit, offset)
|
|
if err != nil {
|
|
writeJSON(w, 500, map[string]string{"error": "无法读取数据源操作记录"})
|
|
return
|
|
}
|
|
w.Header().Set("Cache-Control", "no-store")
|
|
writeJSON(w, 200, map[string]any{"data": page})
|
|
}
|