重构数据权限模型并清理旧RBAC代码
核心变更: - 数据权限过滤从基于账号层级改为基于用户类型的多策略过滤 - 移除 AccountStore 中的 GetSubordinateIDs 等旧方法 - 重构认证中间件,支持 enterprise_id 和 customer_id - 更新 GORM Callback,根据用户类型自动选择过滤策略(代理/企业/个人客户) - 更新所有集成测试以适配新的 API 签名 - 添加功能总结文档和 OpenSpec 归档 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,7 +81,7 @@ func TestAccountRoleAssociation_AssignRoles(t *testing.T) {
|
||||
accService := accountService.New(accountStore, roleStore, accountRoleStore)
|
||||
|
||||
// 创建测试用户上下文
|
||||
userCtx := middleware.SetUserContext(ctx, 1, constants.UserTypeSuperAdmin, 0)
|
||||
userCtx := middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0))
|
||||
|
||||
t.Run("成功分配单个角色", func(t *testing.T) {
|
||||
// 创建测试账号
|
||||
@@ -307,7 +307,7 @@ func TestAccountRoleAssociation_SoftDelete(t *testing.T) {
|
||||
accountRoleStore := postgresStore.NewAccountRoleStore(db)
|
||||
accService := accountService.New(accountStore, roleStore, accountRoleStore)
|
||||
|
||||
userCtx := middleware.SetUserContext(ctx, 1, constants.UserTypeSuperAdmin, 0)
|
||||
userCtx := middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0))
|
||||
|
||||
t.Run("软删除角色后重新分配可以恢复", func(t *testing.T) {
|
||||
// 创建测试数据
|
||||
|
||||
Reference in New Issue
Block a user