fix(listing): 保留平台超管全量商品查看
平台超管通过权限通配符获得全租户查询标记;普通租户管理员仍按所属租户及分销站隔离。
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user