All files / libs/kernel/auth/shared/src/abilities/custom-reports permissions.ts

100% Statements 22/22
100% Branches 3/3
50% Functions 3/6
100% Lines 22/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { SubjectsEnum, type Ability } from '../../types';
 
import { CustomReportsActions } from './actions';
import { viewCustomReportSubject, type ViewCustomReportSubject } from './subjects';
 
export const canViewCustomReports = (ability: Ability) =>
  ability.can(CustomReportsActions.view, SubjectsEnum.CustomReport);
 
export const canViewCustomReportsUnfilteredData = (ability: Ability) =>
  ability.can(CustomReportsActions.view_unfiltered_data, SubjectsEnum.CustomReport);
 
export const canViewThisCustomReport = (ability: Ability, subject: ViewCustomReportSubject) =>
  ability.can(CustomReportsActions.view, viewCustomReportSubject(subject));
 
export const canModifyCustomReports = (ability: Ability) =>
  ability.can(CustomReportsActions.modify, SubjectsEnum.CustomReport);
 
export const canCreateCustomReports = (ability: Ability) =>
  ability.can(CustomReportsActions.create, SubjectsEnum.CustomReport);
 
export const canDeleteCustomReports = (ability: Ability) =>
  ability.can(CustomReportsActions.delete, SubjectsEnum.CustomReport);