Constraint: 切换 main 前必须保存当前七月分支全部项目进展,套餐生效提案仅属于 Iteration/7-11。 Rejected: 将七月套餐修复直接移植到 main | 两个分支的可靠投递架构不同。 Confidence: medium Scope-risk: broad Directive: 不得将本提交整体 cherry-pick 到 main;main 套餐热修必须基于其纯 Asynq 代码独立实施。 Tested: git diff --check;openspec validate fix-package-activation-starvation --strict。 Not-tested: 按用户要求未运行自动化测试;go build ./... 因当前审计改造中的 Enterprise 模型字面量和 role.recordFailure 参数类型错误未通过。
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package audit
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
|
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
|
)
|
|
|
|
// ActorEventFilter 定义操作者行为视角的受控筛选。
|
|
type ActorEventFilter struct {
|
|
Kind string
|
|
ID string
|
|
Action string
|
|
Result string
|
|
Risk string
|
|
ResourceType string
|
|
ResourceID string
|
|
CreatedFrom *time.Time
|
|
CreatedTo *time.Time
|
|
Page int
|
|
PageSize int
|
|
}
|
|
|
|
// ListActorEvents 查询指定人工账号、OpenAPI、系统任务或外部系统的历史行为。
|
|
func (q *Query) ListActorEvents(ctx context.Context, filter ActorEventFilter) (*EventPage, error) {
|
|
if filter.ID == "" || !validActorKind(filter.Kind) {
|
|
return nil, errors.New(errors.CodeInvalidParam)
|
|
}
|
|
return q.List(ctx, EventFilter{
|
|
ActorKind: filter.Kind, ActorID: filter.ID,
|
|
Action: filter.Action, Result: filter.Result, Risk: filter.Risk,
|
|
ResourceType: filter.ResourceType, ResourceID: filter.ResourceID,
|
|
CreatedFrom: filter.CreatedFrom, CreatedTo: filter.CreatedTo,
|
|
Page: filter.Page, PageSize: filter.PageSize,
|
|
})
|
|
}
|
|
|
|
func validActorKind(kind string) bool {
|
|
switch kind {
|
|
case constants.AuditActorAccount, constants.AuditActorPersonalCustomer,
|
|
constants.AuditActorOpenAPI, constants.AuditActorSystemTask,
|
|
constants.AuditActorScheduledJob, constants.AuditActorExternalSystem:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|