import { CloudtSessionUser, UserRoles, CustomSysTenantSetting } from '../model/cloudt/session.user'; import { ApiClientFactory } from '../core/api.client.factory'; import { FontendConfig } from '../model/authConfig.model'; export class AuthService { constructor(protected factory: ApiClientFactory) {} async loadFontendConfig(): Promise { const config = await this.factory.gssApi.get(`/web/projects/frontConfig/config`); return config; } async loadCloudtUser(cloudToken: string): Promise { const user = await this.factory.gssApi.get(`/cloudt/web/session/user?cloudToken=${cloudToken}`); return user; } async loadUserRoles(fullOrgId: string, userId: number): Promise { const roles = await this.factory.gssApi.get('/app/auth/roles', { fullOrgId, userId, }); return roles; } // 获取某个产品是否有权限 async loadProductAuth(projectId: string, productCode: string, tenantId: string, orgId: string): Promise { const roles = await this.factory.entity.get(`/api/web/projects/${projectId}/auth/enableProduct`, { productCode, tenantId, orgId, }); return roles; } // 获取功能权限 async loadGssProductAuth(projectId: string): Promise { const auths = await this.factory.entity.get( `/api/web/projects/${projectId}/gssProductAuth?productCode=gss` ); return auths; } // 获取租户定制化信息 async loadCustomSysTenantSetting(tenantId: string): Promise { const auths = await this.factory.gssApi.get(`/gss/sysTenantSetting/tenants/${tenantId}`); return auths; } // 设置项目自定义配置信息 async setCommonStringConfig(projectId: string, type: string, value: string): Promise { const result = await this.factory.gssApi.post(`/gss/sysProjectSetting/projects/${projectId}`, { projectId, type, value, }); return result; } // 获取项目自定义配置信息 async getCommonStringConfigByTypeCode(projectId: string, typeCode: string): Promise { const result = await this.factory.gssApi.get(`/gss/sysProjectSetting/projects/${projectId}/${typeCode}`); return result; } // 根据项目获取能否嵌入iframe async getIframePermission(projectId: string): Promise { const result = await this.factory.gssApi.get(`/web/projects/${projectId}/sysIframePermission`); return result; } // 简版bi权限 async getAuthEdition(projectId: string): Promise { const result = await this.factory.entity.get(`/gss/api/permission-service/gss/projects/${projectId}/auth/getAuthEdition`); return result; } }