How to use the feathers-permissions.hooks.checkPermissions function in feathers-permissions

To help you get started, we’ve selected a few feathers-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github foxhound87 / rfx-stack / src / api / services / user / hooks.before.js View on Github external
import { hooks as perms } from 'feathers-permissions';
import { setUUID } from '@/api/hooks/setUUID';

/**
  Hook: before
  Service: user
*/
export default {
  all: [],
  find: [
    auth.authenticate(['jwt', 'local']),
    perms.checkPermissions({ service: 'user' }),
  ],
  get: [
    auth.authenticate(['jwt', 'local']),
    perms.checkPermissions({ service: 'user' }),
  ],
  create: [
    setUUID(),
    local.hashPassword(),
  ],
  update: [
    auth.authenticate(['jwt', 'local']),
    perms.checkPermissions({ service: 'user' }),
  ],
  patch: [
    auth.authenticate(['jwt', 'local']),
    perms.checkPermissions({ service: 'user' }),
  ],
  remove: [
    auth.authenticate(['jwt', 'local']),
    perms.checkPermissions({ service: 'user' }),

feathers-permissions

Simple permissions module for Feathers

MIT
Latest version published 4 years ago

Package Health Score

60 / 100
Full package analysis