Skip to content

Commit 46be3f5

Browse files
author
Tom Kirkpatrick
committed
Remove duplicate code
1 parent b4af709 commit 46be3f5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/middleware/user-context.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@ module.exports = function userContextMiddleware() {
2525
const UserModel = app.accessUtils.options.userModel || 'User';
2626
const GroupAccessModel = app.accessUtils.options.groupAccessModel || 'GroupAccess';
2727

28-
2928
return Promise.join(
3029
app.models[UserModel].findById(req.accessToken.userId),
31-
app.models[GroupAccessModel].find({
32-
where: {
33-
userId: req.accessToken.userId
34-
}
35-
}),
30+
app.accessUtils.getUserGroups(req.accessToken.userId),
3631
(user, groups) => {
3732
if (!user) {
3833
return next(new Error('No user with this access token was found.'));

0 commit comments

Comments
 (0)