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 23 24 25 26 27 28 | import { subject } from "@casl/ability"; import { Application, HookContext } from "@feathersjs/feathers"; import { RealTimeConnection } from "@feathersjs/transport-commons/lib/channels/channel/base"; import { FeathersCaslChannelOptions } from "../types"; export default (options?: FeathersCaslChannelOptions): FeathersCaslChannelOptions => { options = options || {} as FeathersCaslChannelOptions; options.activated = options.activated || true; options.channelOnError = options.channelOnError || ["authenticated"]; // eslint-disable-next-line no-unused-vars options.getAbility = options.getAbility || ((app: Application, connection: RealTimeConnection) => { return connection.ability; }); options.getModelName = options.getModelName || ((context: HookContext): string => { const { service } = context; const modelName = service.modelName || service.Model && service.Model.name; return modelName; }); options.restrictFields = options.restrictFields || true; options.subjectHelper = options.subjectHelper || subject; return options; }; |