Last active
June 4, 2020 01:59
-
-
Save parthibanloganathan/ebf59abe10e9e12d8b6454e2b4e8d476 to your computer and use it in GitHub Desktop.
HelpElf
This file contains 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
async function getUserFromFirebaseId(firebaseUserId) { | |
let user = await User.findOne({ firebaseUserId: firebaseUserId }); | |
if (user && user.adminControls.isAdmin) { | |
let spoofedUser = await User.findById( | |
user.adminControls.spoofUserId | |
); | |
if (spoofedUser) { | |
return spoofedUser; | |
} | |
} | |
return user; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment