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 | 1x 79x 79x 79x 1x | import { AnyAbility, Abilities } from "@casl/ability"; import { Rule } from "@casl/ability/dist/types/Rule"; const hasRestrictingConditions = (ability: AnyAbility, action: string, modelName: string): Rule<Abilities, unknown>[]|false => { const rules = ability.possibleRulesFor(action, modelName); const hasConditions = rules.length === 0 || rules.some(x => !!x.conditions); return (hasConditions) ? rules : false; }; export default hasRestrictingConditions; |