Skip to content

Commit

Permalink
fix(gql): query users, improves validations
Browse files Browse the repository at this point in the history
  • Loading branch information
teocomi committed Jul 25, 2020
1 parent 9733cc6 commit 8df402e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/core/graph/resolvers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ module.exports = {
async users(parent, args, context, info) {

await validateServerRole(context, 'server:user')
await validateScopes(context.scopes, 'profile:read')
await validateScopes(context.scopes, 'users:read')

if (!args.id)
await validateScopes(context.scopes, 'profile:read')
else
await validateScopes(context.scopes, 'users:read')
if (!args.query) {
throw new UserInputError('You must provide a search query.')
}

return await findUsers(args.query)
},
Expand Down

0 comments on commit 8df402e

Please sign in to comment.