import { EntityMetadata } from 'typeorm'; import { PrimaryKey } from '../common'; import { KvDef } from '../core/kv/kv.helper'; import { OrgRole, Tenant } from './tenant.entities'; export declare class TenantConfig { enabled?: boolean; activeByDefault?: boolean; bindRoles?: string; /** * bind 的模型 limit 是 1,和 tenant 形成天然的指代关系。 */ firstModelBind?: boolean; firstModelField?: string; firstModelName?: string; firstDisplayName?: string; constructor(o: TenantConfig); } export interface TenantInfo { config: TenantConfig; tenant: Tenant; roles: string[]; recordCounts: { [name: string]: { total: number; published?: number; }; }; } export declare enum TenantFieldKeys { enabled = "enabled", activeByDefault = "active-by-default", bindRoles = "bindRoles", firstModelField = "first.bind-field", firstModelBind = "first.bind", firstModelName = "first.model-name", firstDisplayName = "first.display-name" } export declare class TenantHelper { static kvDef: KvDef; static preload(): Promise; static getTenantEntities(): Promise; static getConfig(): Promise; static info(userId: PrimaryKey): Promise; static isTenantEntity(fullModelName: string): Promise; static hasTenantRole(roles: OrgRole[]): Promise; static tenantSupport(fullModelName: string, roles: OrgRole[]): Promise; static getTenantRoles(roles: OrgRole[]): Promise; static checkPermission(userId: string, fullModelName: string): Promise; static checkResourceLimit(userId: string, fullModelName: string): Promise; }