fix(listing): 保留平台超管全量商品查看

平台超管通过权限通配符获得全租户查询标记;普通租户管理员仍按所属租户及分销站隔离。
This commit is contained in:
2026-11-21 15:24:51 +08:00
parent c22d6b749c
commit b4d058ef63
5 changed files with 43 additions and 3 deletions
+13
View File
@@ -10,6 +10,19 @@ import (
type contextKey struct{}
type adminAllTenantsKey struct{}
// WithAdminAllTenantScope 标记当前管理员拥有平台级全租户查看权限。
// 该标记只用于管理后台查询范围,不改变请求 Host 对应的经营租户上下文。
func WithAdminAllTenantScope(ctx context.Context) context.Context {
return context.WithValue(ctx, adminAllTenantsKey{}, true)
}
func HasAdminAllTenantScope(ctx context.Context) bool {
enabled, _ := ctx.Value(adminAllTenantsKey{}).(bool)
return enabled
}
type Scope struct {
TenantID uint64
TenantCode string