feat(shop-role): 实现店铺角色继承功能和权限检查优化
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s

- 新增店铺角色管理 API 和数据模型
- 实现角色继承和权限检查逻辑
- 添加流程测试框架和集成测试
- 更新权限服务和账号管理逻辑
- 添加数据库迁移脚本
- 归档 OpenSpec 变更文档

Ultraworked with Sisyphus
This commit is contained in:
2026-02-03 10:06:13 +08:00
parent bc7e5d6f6d
commit 5a90caa619
61 changed files with 21284 additions and 131 deletions

View File

@@ -33,7 +33,7 @@ func TestPermissionService_CheckPermission_SuperAdmin(t *testing.T) {
permStore := postgres.NewPermissionStore(tx)
accountRoleStore := postgres.NewAccountRoleStore(tx, rdb)
rolePermStore := postgres.NewRolePermissionStore(tx, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, nil, rdb)
t.Run("超级管理员自动拥有所有权限", func(t *testing.T) {
ctx := createContextWithUserType(1, constants.UserTypeSuperAdmin)
@@ -53,7 +53,7 @@ func TestPermissionService_CheckPermission_NormalUser(t *testing.T) {
accountRoleStore := postgres.NewAccountRoleStore(tx, rdb)
rolePermStore := postgres.NewRolePermissionStore(tx, rdb)
roleStore := postgres.NewRoleStore(tx)
service := permission.New(permStore, accountRoleStore, rolePermStore, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, nil, rdb)
ctx := createContextWithUserType(100, constants.UserTypePlatform)
@@ -173,7 +173,7 @@ func TestPermissionService_CheckPermission_NoRole(t *testing.T) {
permStore := postgres.NewPermissionStore(tx)
accountRoleStore := postgres.NewAccountRoleStore(tx, rdb)
rolePermStore := postgres.NewRolePermissionStore(tx, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, nil, rdb)
t.Run("用户无角色应返回false", func(t *testing.T) {
ctx := createContextWithUserType(200, constants.UserTypePlatform)
@@ -193,7 +193,7 @@ func TestPermissionService_CheckPermission_RoleNoPermission(t *testing.T) {
accountRoleStore := postgres.NewAccountRoleStore(tx, rdb)
rolePermStore := postgres.NewRolePermissionStore(tx, rdb)
roleStore := postgres.NewRoleStore(tx)
service := permission.New(permStore, accountRoleStore, rolePermStore, rdb)
service := permission.New(permStore, accountRoleStore, rolePermStore, nil, rdb)
ctx := createContextWithUserType(300, constants.UserTypePlatform)