Created
December 28, 2018 13:33
-
-
Save nabiltntn/017a8321d5cc61572c69ab98682eb341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For resolvers that require authenticated users with SUPER_ADMIN role | |
| export const isSuperAdminResolver = (resolver, trackDetails) => | |
| isAuthenticated.createResolver((root, args, context) => { | |
| if (context.user.role !== Constants.UsersRolesToIds.SUPER_ADMIN) { | |
| throw new Errors.ForbiddenError(); | |
| } | |
| return executeWithTracking(resolver, root, args, context, trackDetails); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment