refactor: 数据权限过滤从 GORM Callback 改为 Store 层显式调用
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m2s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m2s
- 移除 RegisterDataPermissionCallback 和 SkipDataPermission 机制 - 在 Auth 中间件预计算 SubordinateShopIDs 并注入 Context - 新增 ApplyShopFilter/ApplyEnterpriseFilter/ApplyOwnerShopFilter 等 Helper 函数 - 所有 Store 层查询方法显式调用数据权限过滤函数 - 权限检查函数 CanManageShop/CanManageEnterprise 改为从 Context 获取数据 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,16 +4,17 @@ import "time"
|
||||
|
||||
// Fiber Locals 的上下文键
|
||||
const (
|
||||
ContextKeyRequestID = "requestid" // 请求记录ID
|
||||
ContextKeyStartTime = "start_time" // 请求开始时间
|
||||
ContextKeyUserID = "user_id" // 用户ID
|
||||
ContextKeyUserType = "user_type" // 用户类型
|
||||
ContextKeyShopID = "shop_id" // 店铺ID
|
||||
ContextKeyEnterpriseID = "enterprise_id" // 企业ID
|
||||
ContextKeyCustomerID = "customer_id" // 个人客户ID
|
||||
ContextKeyUserInfo = "user_info" // 完整的用户信息
|
||||
ContextKeyIP = "ip_address" // IP地址
|
||||
ContextKeyUserAgent = "user_agent" // User-Agent
|
||||
ContextKeyRequestID = "requestid" // 请求记录ID
|
||||
ContextKeyStartTime = "start_time" // 请求开始时间
|
||||
ContextKeyUserID = "user_id" // 用户ID
|
||||
ContextKeyUserType = "user_type" // 用户类型
|
||||
ContextKeyShopID = "shop_id" // 店铺ID
|
||||
ContextKeyEnterpriseID = "enterprise_id" // 企业ID
|
||||
ContextKeyCustomerID = "customer_id" // 个人客户ID
|
||||
ContextKeyUserInfo = "user_info" // 完整的用户信息
|
||||
ContextKeyIP = "ip_address" // IP地址
|
||||
ContextKeyUserAgent = "user_agent" // User-Agent
|
||||
ContextKeySubordinateShopIDs = "subordinate_shop_ids" // 下级店铺ID列表(代理用户预计算)
|
||||
)
|
||||
|
||||
// 配置环境变量
|
||||
|
||||
Reference in New Issue
Block a user