From 149a68ec8c0ccbfe50060113bfb4ebdedb16111d Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Fri, 24 Jul 2020 11:47:25 -0300 Subject: [PATCH] fix: allow async check --- src/resolvers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resolvers.ts b/src/resolvers.ts index a4d5805..4ceaa15 100644 --- a/src/resolvers.ts +++ b/src/resolvers.ts @@ -68,10 +68,10 @@ const checkUserCanDoRegistration = (req: Request): boolean => { return true; }; -const checkUserIsPartOfStaffOrIsTheCurrentUser = ( +const checkUserIsPartOfStaffOrIsTheCurrentUser = async ( req: Request, user: User, -): boolean => { +): Promise => { if (isAdmin(req)) { return true; } @@ -84,7 +84,7 @@ const checkUserIsPartOfStaffOrIsTheCurrentUser = ( if ( getIntersection(roles, ['admin']).length >= 1 || - isUserAllowedToChangePassword(currentUserId, user, req) + (await isUserAllowedToChangePassword(currentUserId, user, req)) ) { return true; }