@forestadmin/forestadmin-client
Version:
This package contains the logic to use the ForestAdmin API inside an agent.
43 lines • 1.89 kB
TypeScript
import { CollectionRenderingPermissionV4, RawTree, Team, UserPermissionV4 } from './types';
import UserPermissionService from './user-permission';
import { Chart } from '../charts/types';
import { ForestAdminClientOptionsWithDefaults, ForestAdminServerInterface } from '../types';
export type RenderingPermission = {
team: Team;
collections: Record<string, CollectionRenderingPermissionV4>;
charts: Set<string>;
};
export default class RenderingPermissionService {
private readonly options;
private readonly userPermissions;
private readonly forestAdminServerInterface;
private readonly permissionsByRendering;
constructor(options: ForestAdminClientOptionsWithDefaults, userPermissions: UserPermissionService, forestAdminServerInterface: ForestAdminServerInterface);
getScope({ renderingId, collectionName, userId, }: {
renderingId: number | string;
collectionName: string;
userId: number | string;
}): Promise<RawTree>;
private getScopeOrRetry;
canExecuteSegmentQuery({ renderingId, collectionName, segmentQuery, connectionName, userId, }: {
renderingId: number | string;
collectionName: string;
segmentQuery: string;
connectionName?: string;
userId: number;
}): Promise<boolean>;
private canExecuteSegmentQueryOrRetry;
private loadPermissions;
private isQueryChart;
canExecuteChart({ renderingId, chartRequest, userId, }: {
renderingId: number | string;
chartRequest: Chart;
userId: number | string;
}): Promise<boolean>;
private canRetrieveChartHashOrRetry;
invalidateCache(renderingId: number | string): void;
invalidateAllCache(): void;
getUser(userId: number | string): Promise<UserPermissionV4>;
getTeam(renderingId: number | string): Promise<Team>;
}
//# sourceMappingURL=rendering-permission.d.ts.map