Skip to content

Instantly share code, notes, and snippets.

@parthibanloganathan
Last active June 4, 2020 01:59
Show Gist options
  • Save parthibanloganathan/ebf59abe10e9e12d8b6454e2b4e8d476 to your computer and use it in GitHub Desktop.
Save parthibanloganathan/ebf59abe10e9e12d8b6454e2b4e8d476 to your computer and use it in GitHub Desktop.
HelpElf
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