Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('returns expected hooks', () => {
assert.equal(restrictToAuthenticated[0].toString(), auth.verifyToken().toString());
assert.equal(restrictToAuthenticated[1].toString(), auth.populateUser().toString());
assert.equal(restrictToAuthenticated[2].toString(),
auth.restrictToAuthenticated().toString());
});
});
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const gravatar = require('./gravatar');
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: 'id' })
],
create: [
auth.hashPassword(), gravatar()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: 'id' })
],
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const process = require('./process');
const restrictToSender = require('./restrict-to-sender');
const populateSender = hooks.populate('sentBy', {
service: 'users',
field: 'id'
});
exports.before = {
all: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
find: [],
get: [],
create: [process()],
update: [hooks.remove('sentBy'), restrictToSender()],
patch: [hooks.remove('sentBy'), restrictToSender()],
remove: [restrictToSender()]
};
exports.after = {
all: [],
find: [populateSender],
get: [populateSender],
create: [populateSender],
update: [],
patch: [],
'use strict';
import resize from './resize';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const dauria = require('dauria');
const permissionName = 'manageMedia';
exports.before = {
create: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName),
resize()
]
};
exports.after = {
all: [],
find: [],
get: [],
create: [
],
update: [],
patch: [],
const auth = require('feathers-authentication').hooks;
const permissionName = 'manageMedia';
exports.before = {
all: [],
find: [
],
get: [
],
create: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
patch: [
globalHooks.allowUpsert(),
auth.verifyToken(),
auth.populateUser(),
'use strict';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const permissionName = 'moderateComments';
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.hasPermission(permissionName)
],
create: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),