Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
removeAllRelatedUserData()
]
},
after: {
all: [
cleanupBasicData
],
find: [
when(isModerator(),
populate({ schema: userSettingsSchema })
),
when(isSingleItem(),
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema })
),
thumbnails(thumbnailOptions),
cleanupPersonalData
],
get: [
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema }),
thumbnails(thumbnailOptions),
// remove personal data if its not the current authenticated user
iff(isOwnEntry(false),
cleanupPersonalData
),
iff(isOwnEntry(),
populate({ schema: userSettingsPrivateSchema })
)
isVerified(),
stashBefore(),
restrictToOwnerOrModerator({ isEnabled: true })
]
},
after: {
all: [
xss({ fields: xssFields }),
populate({ schema: reviewerSchema })
// populate({ schema: userSchema }),
// populate({ schema: followerSchema })
],
find: [
when(isSingleItem(),
populate({schema: categoriesSchema})
),
thumbnails(thumbnailOptions)
],
get: [
populate({schema: categoriesSchema}),
thumbnails(thumbnailOptions)
],
create: [
thumbnails(thumbnailOptions)
],
update: [
thumbnails(thumbnailOptions)
],
patch: [],
remove: []
},
populate({ schema: userSettingsSchema })
),
thumbnails(thumbnailOptions),
cleanupPersonalData
],
get: [
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema }),
thumbnails(thumbnailOptions),
// remove personal data if its not the current authenticated user
iff(isOwnEntry(false),
cleanupPersonalData
),
iff(isOwnEntry(),
populate({ schema: userSettingsPrivateSchema })
)
],
create: [
when(isProvider('external'),
sendVerificationEmail()
),
when(isProvider('external'),
removeVerification()
),
thumbnails(thumbnailOptions),
inviteCode.after
],
update: [
thumbnails(thumbnailOptions)
],
patch: [],
saveRemoteImages(['avatar', 'coverImg'])
],
remove: [
...restrict,
disableMultiItemChange(),
removeAllRelatedUserData()
]
},
after: {
all: [
cleanupBasicData
],
find: [
when(isModerator(),
populate({ schema: userSettingsSchema })
),
when(isSingleItem(),
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema })
),
thumbnails(thumbnailOptions),
cleanupPersonalData
],
get: [
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema }),
thumbnails(thumbnailOptions),
// remove personal data if its not the current authenticated user
iff(isOwnEntry(false),
disableMultiItemChange(),
removeAllRelatedUserData()
]
},
after: {
all: [
cleanupBasicData
],
find: [
when(isModerator(),
populate({ schema: userSettingsSchema })
),
when(isSingleItem(),
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema })
),
thumbnails(thumbnailOptions),
cleanupPersonalData
],
get: [
populate({ schema: badgesSchema }),
populate({ schema: candosSchema }),
populate({ schema: userSettingsSchema }),
thumbnails(thumbnailOptions),
// remove personal data if its not the current authenticated user
iff(isOwnEntry(false),
cleanupPersonalData
),
iff(isOwnEntry(),
populate({ schema: userSettingsPrivateSchema })
'use strict';
const process = require('./process');
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks-common');
const auth = require('feathers-authentication').hooks;
const populateAuthor = hooks.populate({
schema: {
include: [{
service: 'users',
nameAs: 'authorInfo',
parentField: 'author',
childField: '_id'
}]
}
});
exports.before = {
all: [],
find: [],
get: [],
create: [
auth.verifyToken(),
this.service("authentication").before({
create: [
auth.hooks.authenticate(["jwt", "local"])
]
})
this.service("authManagement").before({
create: [
hooks.iff(
isAction("passwordChange", "identityChange"),
auth.hooks.authenticate(["jwt", "local"])
),
hooks.iff(
isAction("resendVerifySignup", "passwordChange", "identityChange"),
hooks.populate({
include: {
service: "users"
}
})
)
]
})
}