UNPKG

@commercetools-frontend/permissions

Version:
50 lines (49 loc) 2.06 kB
type TPermissionName = string; type TPermissions = { [key: string]: boolean; }; type TActionRightName = string; type TActionRightGroup = string; type TDemandedActionRight = { group: TActionRightGroup; name: TActionRightName; }; type TActionRight = { [key: string]: boolean; }; type TActionRights = { [key: string]: TActionRight; }; type TDataFenceGroupedByPermission = { [key: string]: { values: string[]; } | null; }; type TDataFenceGroupedByResourceType = { [key: string]: TDataFenceGroupedByPermission | null; }; type TDataFenceType = 'store'; type TDataFences = Partial<Record<TDataFenceType, TDataFenceGroupedByResourceType>>; type TDemandedDataFence = { group: string; name: string; type: string; }; type TDemandedDataFenceWithValues = TDemandedDataFence & { actualDataFenceValues: string[]; }; type TSelectDataFenceData = (demandedDataFenceWithActualValues: TDemandedDataFenceWithValues) => string[] | null; type TOptionsForAppliedDataFence = { actualPermissions: TPermissions | null; demandedDataFences: TDemandedDataFence[]; actualDataFences: TDataFences | null; selectDataFenceData?: TSelectDataFenceData; }; export declare const getImpliedPermissions: (permissions: TPermissionName[]) => TPermissionName[]; export declare const hasPermission: (demandedPermission: TPermissionName, actualPermissions: TPermissions | null) => boolean; export declare const hasActionRight: (demandedActionRight: TDemandedActionRight, actualActionRights: TActionRights | null) => boolean; export declare const hasEveryPermissions: (demandedPermissions: TPermissionName[], actualPermissions: TPermissions | null) => boolean; export declare const hasEveryActionRight: (demandedActionRights: TDemandedActionRight[], actualActionRights: TActionRights | null) => boolean; export declare const hasSomePermissions: (demandedPermissions: TPermissionName[], actualPermissions: TPermissions | null) => boolean; export declare const hasSomeDataFence: (options: TOptionsForAppliedDataFence) => boolean; export {};